Kamis, 15 Oktober 2015

[MS_AccessPros] VBScript to open and backup

 

Pros,

I'm trying to write a VBScript to backup a DB back end the first time it is opened during a day and open a Front End. The script is failing when I try to insert the date into the Destinationfile. Can someone please help? Here is the script:

dim DestinationFile

dim accessApp
set accessApp = createObject("Access.Application")
DestinationFile = "S:\FCS\GCS\GCS_Backups\Guiding Children Successfully_" & Date() & ".accdb"
Const SourceFile = "s:\FCS\GCS\Guiding Children Successfully.accdb"
Set fso = CreateObject("Scripting.FileSystemObject")
    If fso.FileExists(DestinationFile) Then
       accessApp.OpenCurrentDataBase("c:\gcsfe\gcsfe.accde")

Else
            fso.CopyFile SourceFile, DestinationFile, True
            accessApp.OpenCurrentDataBase("c:\gcsfe\gcsfe.accde")
    End If
Set fso = Nothing
set accessApp = nothing


Doyce

__._,_.___

Posted by: winberry.doyce@roadsysinc.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

.

__,_._,___

Tidak ada komentar:

Posting Komentar