Doyce
It's time to debug. Put a msgbox right after the Destination assignment and make the msgbox show that string. Is it what you expected?
Regards,
Bill Mosca,
Founder, MS_Access_Professionals
That'll do IT http://thatlldoit.com
MS Access MVP
http://mvp.microsoft.com/en-us/mvp/Bill%20Mosca-35852
My Nothing-to-do-with Access blog
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Thursday, October 15, 2015 8:26 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: [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: "Bill Mosca" <wrmosca@comcast.net>
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (4) |
Tidak ada komentar:
Posting Komentar