• Access Backup utility not available in VB code (Access 2003)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Access Backup utility not available in VB code (Access 2003)

    Author
    Topic
    #409600

    I am trying to use a command button on a form to enable a user to bring up the backup utility you get from the menubar under the “File” item. Thus on the event click in VBA code:

    Application.RunCommand AccmdBackup
    (or DoCmd.RunCommand 513, 513 being the number for the backup item)

    I get “Run-time error 2046: The command or action “Backup” isn’t available now.”

    I’ve looked all over and can’t find a solution to this problem. If you know of one, please pass it on to me.

    I’ve done a workaround using the DOS copy command in a one-line batch file “copy %1 %2” and using Shell(file.bat sourcefile destinationfile), but I’m afraid in the future there will be no DOS commands available in Windows and would like to get the Access command to work right. (The sourcefile and destinationfile are selected by the user by way if an inputbox).

    Any help appreciated,

    Jim Gansle

    Viewing 1 reply thread
    Author
    Replies
    • #874204
      • #874609

        Thanks so much for replying, Dave. I had seen that article before but didn’t think it applied to my situation because it talked of the problem in the context of automation (which doesn’t apply to the application I’m working with) and specifically addressed different commands than I was concerned with. Actually, I tried something like the first workaround provided in the article (putting the focus on the database window before invoking the backup command), but no go. But after I got your message I decided to try both workarounds in the article. Unfortunately both still resulted in the same old error message.

        Jim Gansle

      • #874610

        Thanks so much for replying, Dave. I had seen that article before but didn’t think it applied to my situation because it talked of the problem in the context of automation (which doesn’t apply to the application I’m working with) and specifically addressed different commands than I was concerned with. Actually, I tried something like the first workaround provided in the article (putting the focus on the database window before invoking the backup command), but no go. But after I got your message I decided to try both workarounds in the article. Unfortunately both still resulted in the same old error message.

        Jim Gansle

    • #874205
    Viewing 1 reply thread
    Reply To: Access Backup utility not available in VB code (Access 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: