locked
How to backup a Access Database in javascript or vbscript RRS feed

  • Question

  • Hello All,

    How to Backup a Access Database in Javascript or VBscript.

    Can anyone tell me How to achieve this one.



    Thanks in Advance.


     
    Monday, November 3, 2008 5:48 AM

All replies

  • hi lingu,

    its for update the db table make changes for db

     

    Option Explicit

    const ForAppending = 8

    Dim SQL, fso, log, oAccess

    'Set up Log file

    set fso=CreateObject("Scripting.filesystemobject")

    set log = fso.OpenTextFile("\\vharosfiles\shared\DataManagement\Logs\BackupData.log",ForAppending)

    log.writeline(now & " BackupData.vbs Started")

    'Open Access and Run SQL that will create backup table

    set oAccess = createobject("Access.application")

    oAccess.OpenCurrentDatabase "\\vharosfiles\shared\DataManagement\StratPlan\StratPlanBackup.mdb"

    log.writeline(now & " Access Back Database Opened")

    'oAccess.visible=true

    SQL = "SELECT [Goals & Objectives].* INTO [Goals&ObjectivesBackup" & now & "] FROM [Goals & Objectives];"

    oAccess.DoCmd.runsql SQL

    log.writeline(now & " Backup Table Created")

    oAccess.quit

    log.writeline(now & " Script Finished")

    set oAccess = nothing

    set log = nothing

    set fso= nothing

    Monday, November 3, 2008 7:28 AM