Results 1 to 3 of 3
  1. #1
    Samortensen is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Jun 2016
    Posts
    2

    Question Macro to back up Database

    Hello - I currently have many databases that I maintain and due to the importance of them, I back them up on a weekly basis. We have scripts that are kicked off through Windows task scheduler that opens these specific databases and updates them on an overnight run process. I want to take one of those scripts and rewrite it to run a macro in the database to back up the database with a date in the name.



    The problem is, I thought that I could create this using an action out of the system commands - however, I am using Office 365 and I do not see the back up database command, nor do I see one called Copydatabaseobject in the action catalog as I read in some other posts here.

    Does anyone have an idea as to how I can create this macro or if this is even possible?

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,409
    We have scripts that are kicked off through Windows task scheduler that opens these specific databases
    if you are using these, why not have one to copy the database to a backup location rather than open a db to run some code to effectively do the same thing?

  3. #3
    Samortensen is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Jun 2016
    Posts
    2
    Very good idea - unfortunately no one knows how to write it to tell it to do that.
    Currently the script pertaining to the overnight process reads:

    Dim db
    Dim strDbName
    dim strPassword
    dim strMacro
    strMacro = "** Run Spending Plan Database"
    strdbName = "\\msp0ms01\pine bend project controls\Reporting\Databases\Spending Plan DB\Project_Portfolio_Reporting.accdb"
    strPassword = ""
    Set acc = createobject("Access.Application")
    ' this temporarily changes the macros security to low to avoid messages.
    'onlt works with access 2000 onwards
    if acc.syscmd(7) >= 10 Then
    acc.AutomationSecurity = 1
    End if

    'if you do not need to see Access delete this line
    acc.Visible = True
    Set db = acc.DBEngine.OpenDatabase(strDbName, False, False, ";PWD=" & strPassword)
    acc.OpenCurrentDatabase strDbName
    acc.docmd.runmacro strMacro
    db.Close
    Would anyone know how to write one that could accomplish this? I certainly do not have that knowledge and so I thought a macro would suffice.

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

Similar Threads

  1. Replies: 1
    Last Post: 03-21-2015, 11:55 AM
  2. Replies: 4
    Last Post: 05-21-2012, 08:21 AM
  3. Back End Database Locking
    By sai_rlaf in forum Database Design
    Replies: 2
    Last Post: 02-28-2012, 02:20 PM
  4. Help on macro to scroll one record back?
    By getholdofjoru in forum Forms
    Replies: 2
    Last Post: 06-19-2010, 03:01 PM
  5. Back up database
    By sdondeti in forum Access
    Replies: 15
    Last Post: 11-03-2009, 02:17 PM

Tags for this Thread

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