Writing a Macro for a Backup of my database file

M

M.Simpson

My database file name is storage.mdb and its in My Documents, how do I write
a macro to automaticly download it to the A;/drive
 
C

Chris Reveille

See my reply to post on Mar 8 2005 11:43AM for question
How do I automate back-up of an MS Access Database? asked
by NeedAcessHelp posted on Mar 7 2005 2:37PM


Chris
 
M

M.Simpson

Dear Chris, I can't write in VBA, I have to do it with Macro's, I can't find
your other responses to people's question, sorry, please help

Chris Reveille said:
See my reply to post on Mar 8 2005 11:43AM for question
How do I automate back-up of an MS Access Database? asked
by NeedAcessHelp posted on Mar 7 2005 2:37PM


Chris
 
C

Chris Reveille

This is very simple to do in VBA
Open a form in design view
click on properties
click on events
in the on load event
click on the end of line and then the 3 dots ...
select code builder
copy the code below
and paste between the start and end of the sub
Change "\\path to and file name of file copying" and "path
to and file name of destination" to your desired filwe
locations

When done select tools/references on menu and make sure yoe
have window scripting host checked. You may have to scroll
down.

Don't worry it is easy. Do try this on test databases first.
Previous post...........................
What I do is use visual basic on a form which opens when
you open the database. It appends todays date to the file
name. I use the Windows Task Scheduler to run this daily.
Before you can use the FileSystemObject you must set a
reference to the Windows scripting host in your vb references.
**********************************

Dim fso As Object
Dim boverwrite As Boolean
Set fso = CreateObject("Scripting.fileSystemObject")

fso.copyfile "\\path to and file name of file copying",
"path to and file name of destination " & Format(Date,
"mmddyy") & ".mdb"

Set fso = Nothing
MsgBox "*** All Files have Been copied ***", vbInformation, ""
End Sub
***************************************

Good Luck

Chris
-----Original Message-----
Dear Chris, I can't write in VBA, I have to do it with Macro's, I can't find
your other responses to people's question, sorry, please help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top