dim strBackupDate as String
strBackupDate = Format(Date, "mm-dd-yy")
DestinationFile = "S:\FCS\GCS\GCS_Backups\Guiding Children Successfully_" & strBackupDate & ".accdb"
Darrell
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Thursday, October 15, 2015 12:27 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: RE: [MS_AccessPros] VBScript to open and backup
Bill,
I was wondering how to do that. You provided a good answer. Here is what I found, It is putting slashes in the date! filename_10/15/15.accdb. How do I format the date with dashes instead?
Doyce
---In MS_Access_Professionals@yahoogroups.com, <wrmosca@...> wrote :
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
The information contained in this communication is highly confidential and is intended solely for the use of the individual(s) to whom this communication is directed. If you are not the intended recipient, you are hereby notified that any viewing, copying, disclosure or distribution of this information is prohibited. Please notify the sender, by electronic mail or telephone, of any unintended receipt and delete the original message without making any copies.
Blue Cross Blue Shield of Michigan and Blue Care Network of Michigan are nonprofit corporations and independent licensees of the Blue Cross and Blue Shield Association.
Posted by: "Embrey, Darrell" <DEmbrey@bcbsm.com>
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (6) |
Tidak ada komentar:
Posting Komentar