Save Database

aussie

Registered User.
Local time
Tomorrow, 08:02
Joined
May 27, 2012
Messages
47
Hi,
Does anyone know how to write a macro that saves a database to
c:\My Documents\filename on exit.
 
Are you wanting to save your work or are you looking to make a copy as a BackUp.
 
I am looking to make a copy as a backup
 
Which file do you wish to back up.

I would think it would be the Back End which holds the data. Not the front end with the GUI.
 
i would like to save the the entire database. I have tried to set a macro with the Save As command, but it doesn't like that.
 
Which file do you wish to back up.

I would think it would be the Back End which holds the data. Not the front end with the GUI.

Aussie

This is like pulling teeth.

There could be different solutions to what you want if I knew exactly what you wanted to back up.

And as a further question why do you need to back up on close. Why not every Hour, or on open, or when a new user comes along. What if the user only closes the DB on Friday afternoons. A long time between drinks.
 
I want to backup a database called Sudweeks. Sudweeks is on a USB stick because it goes between two computers, one on site and one off site. I want to backup onto the hard drive of each computer on exiting the database to : C:\Documents And Settings\My Documents\Sudweeks.

I have made the following code, don't know if I am supposed to prefix it with anything, it needs to activate when I click on a button called Backup.


Function BACKUPS()
Dim fso As Object
Dim sSourcePath As String
Dim sSourceFile As String
Dim sBackupPath As String
Dim sBackupFile As String
Dim db As New Access.Application
Dim buf As String
Dim strBu As String
sSourceFile = Sudweeks.Name
sSourcePath = Sudweeks.Path & "\"
sBackupFile = Sudweeks.Name
sBackupPath = C:\Documents And Settings\ My Documents\Sudweeks.Path
buf = Sudweeks.Path & "\Backups\"
Set fso = CreateObject
fso.CopyFile sSourcePath & sSourceFile, sBackupPath & sBackupFile, True
Set fso = Nothing
Beep
MsgBox "Backup was successful and saved @ " & Chr(13) & Chr(13) & sBackupPath & Chr(13) & Chr(13) & "The backup file name is " & Chr(13) & Chr(13) & sBackupFile, vbInformation, "Backup Completed"
End Function
Private Sub Backup_Click()
End Sub
 
Aussie

In my signature there is a link to my Secret Code.

Go there and grab the Database in the Folder "Compact Repair and Decompile"
I think it does what you want. It will save to any location.
It will do a compact and repair and also a decompile.

It is only tested up to A 2003 so if you are using a later version please send me a PM and let me know if you find a problem.
 
Hi Rain,

When I click on the link to your secret code, it opens up Windows Live, and gives me the following message:

This item might have been deleted, expired or you might not have permission to access it. Contact the owner of this item for more information. More information

So I can't access the Database in the Folder "Compact Repair and Decompile"
Thanks, aussie
 
Something is wrong with my Sky Drive.

I will fix later.

See attached.
 

Attachments

Hi Rain,

Thank you, I downloaded your file and just got runtime errors.

I am not looking for anything complicated, I just want to have a button which the user clicks, and it saves the current database (d:\Sudweeks) to c:\Documents and Settings\My Documents

I am hoping you can help me with this.
Kind regards
aussie
 
Thank you, I downloaded your file and just got runtime errors.

I am having a bit of a problem with that file, so I have been informed.

I will fix tomorrow and repost.
 

Users who are viewing this thread

Back
Top Bottom