Results 1 to 7 of 7
  1. #1
    otfries is offline Novice
    Windows 7 32bit Access 2016
    Join Date
    Jan 2018
    Posts
    6

    Problem with converting to ACCDE


    I have a split database with the backend file on a server, and the frontend on about a dozen different workstations. I have a form with code that works perfectly in all workstations in ACCDB, but as soon as I save as ACCDE my [RunCommand acCmdSaveRecord] and [RunCommand acCmdUndo] do not work. I get an error saying these commands are are not available. I compiled code, I have carefully checked for empty subs, I have gone as far as creating a new frontend and imported only this form and the needed supporting forms, and the same thing happens. Any advice?

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    The old RunCommand methods have in almost all cases been superceded with more efficient code
    I suggest you use different code to save records (if using an unbound form - its automatic in a bound form) or to undo changes
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    otfries is offline Novice
    Windows 10 Office 365
    Join Date
    Jan 2018
    Posts
    6
    Thanks a lot for your reply. This is a bound form, but I don't want the autosave option. I have these commands after an [If Me.Dirty Then] to warn the users that they are leaving a dirty form, and allow the user to select "save" or "cancel".

  4. #4
    otfries is offline Novice
    Windows 10 Office 365
    Join Date
    Jan 2018
    Posts
    6
    I have record buttons on form for "Next", Previous", and "New", where I just use the below code with just the one command word change of acNext, acPrevious etc. in the button code. Note again, this code works in accdb but not in accde.

    Code:
    Private Sub NewButton_Click()
    
        If CheckSave = False Then
            Exit Sub
        Else
            DoCmd.GoToRecord , , acNewRec
        End If
    
    End Sub
    
    Private Function CheckSave() As Boolean
        
        CheckSave = True
    
        If Me.Dirty Then
            DoCmd.Beep
            ' "Save" dialog box with options Yes=1, No=2, Cancel=0
            x = uDialog3(ErrorString(19), ErrorTitle(19))
                If x = 1 Then
                    If IsNull(WeighType) Then
                        'MessageBox warning that transaction cannot be saved with [Weightype] left blank, or if
                        '[WeighType]=2, StorageInOut] has to have a value as well
                        uDialog ErrorString(33), ErrorTitle(33)
                        CheckSave = False
                    ElseIf WeighType = 2 And IsNull(StorageInOut) Then
                        uDialog ErrorString(34), ErrorTitle(34)
                        CheckSave = False
                    Else
                        RunCommand acCmdSaveRecord
                        'Sub that locks or unlocks text boxes on form depending on different statuses of transactions.
                        FmLock
                    End If
                ElseIf x = 2 Then
                    RunCommand acCmdUndo
                ElseIf x = 0 Then
                    CheckSave = False
                End If
        Else
            CheckSave = True
        End If
        
    End Function

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    When you edit a record and move off of it, the record in a bound form is automatically saved. There is no such thing as an auto save. Clicking on a button is enough to cause the record change to save because the button isn't a field in the record, it is a separate object. Maybe you need to study up on how bound forms work - not sure. BTW, this has nothing to do with the db being accde or accdb aside from what you've already been told about using RunCommand. I would also check to see if you have any empty routines and if you do, delete them and see what happens.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    otfries is offline Novice
    Windows 10 Office 365
    Join Date
    Jan 2018
    Posts
    6
    I did check on empty routines. I don't find any. If you say RunCommand is outdated, what is the new code to save a record or Undo?

  7. #7
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Again, you don't need to do anything to save a record on a bound form, but you can do so if you think you need it. Even closing the form saves the record. But to save a record,
    If Me.Dirty Then Me.Dirty = False will force a save. I'd say if not using a button click event, then perhaps Current event. However, current event will fire when the form first opens, so take that in to consideration. With what I posted here, the form won't be dirty so nothing should be noticeable.

    Undo is another matter and is usually handled in the form BeforeUpdate event because you can cancel the save if you want the user to confirm the changes or not. Just be sure to have your Me.Undo line before the Cancel = True line if you want to cancel the record changes.
    Last edited by Micron; 03-02-2021 at 05:44 PM. Reason: clarification
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Problem converting ADP Access file to MDB
    By amkweb in forum Programming
    Replies: 2
    Last Post: 09-29-2016, 06:16 AM
  2. Replies: 15
    Last Post: 04-27-2015, 12:19 PM
  3. problem converting to (Accde)
    By azhar2006 in forum Access
    Replies: 3
    Last Post: 07-16-2014, 09:32 AM
  4. ACCDE Problem
    By smikkelsen in forum Access
    Replies: 1
    Last Post: 07-13-2010, 12:26 AM
  5. Make ACCDE problem
    By Eric1066 in forum Access
    Replies: 3
    Last Post: 11-27-2009, 04:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums