PC Review


Reply
Thread Tools Rate Thread

Backup of Database

 
 
Aamer
Guest
Posts: n/a
 
      11th Jan 2010
I would like to place a botton on a form which will make a backup of the
entire database or just the tables

Can somone help me with the code or how to make a macro


 
Reply With Quote
 
 
 
 
Tom van Stiphout
Guest
Posts: n/a
 
      11th Jan 2010
On Mon, 11 Jan 2010 05:25:01 -0800, Aamer
<(E-Mail Removed)> wrote:

You can't really backup yourself because you would be in use.

It sounds like you have not split your database? That would be a
mistake.
Once split you can make a backup from the server using its backup
software.
The front-end doesn't really need to be backed up; if needed you can
simply get a new copy. There typically is no data in the front-end.

-Tom.
Microsoft Access MVP


>I would like to place a botton on a form which will make a backup of the
>entire database or just the tables
>
>Can somone help me with the code or how to make a macro
>

 
Reply With Quote
 
Mark Andrews
Guest
Posts: n/a
 
      11th Jan 2010
Aamer,

Step1: make sure you split your database.
Step 2: make a button on a form to call this code

Here's a function I made to backup the back-end database.
My back-end db is always called:
"Donation_BE.accdb"
Probably have to tweak the code a little but hope you get the idea.
OpenForm is another function that opens certain forms I have, just open the
main form in your db.

Public Function BackupBackEnd()
On Error GoTo Err_BackupBackEnd

Dim strBackEndFullPath As String
Dim strNewPath As String

Dim i As Integer
Dim intCount As Integer

strBackEndFullPath = GetDataPath("tblContact") 'full DB path and name
strNewPath = Replace(strBackEndFullPath, "Donation_BE.accdb", "") &
"DonationBackup_" & Format(Now(), "yyyymmdd") & ".accdb" 'remove DB name
from path and add filename with date
If (MsgBox("Ok to backup your data to: " & strNewPath, vbOKCancel,
"Confirm Backup is OK to Begin") = vbOK) Then
'close all forms (so back-end is not open)
intCount = Forms.Count - 1
For i = intCount To 0 Step -1
DoCmd.Close acForm, Forms(i).Name
Next

'copy file
FileCopy strBackEndFullPath, strNewPath
MsgBox "Backup of database created: " & strNewPath
Call OpenForm("frmContactList", 1)
End If

Exit_BackupBackEnd:
Exit Function
Err_BackupBackEnd:
Select Case Err.Number
Case 70, 3356
MsgBox "Cannot backup just now - the database is already open.
Possibly another user is using the database?"
Case 68, 71, 76
MsgBox "Backup failed! Backup folder is not available or cannot
be created or device is not ready."
Case Else
MsgBox "Error " & Err.Number & " (" & Err.Description & ")"
End Select
Resume Exit_BackupBackEnd
End Function

HTH,
Mark Andrews
RPT Software
http://www.rptsoftware.com

PS: If you want to see it in action download and install the evaluation from
http://www.donationmanagementsoftware.com



"Aamer" <(E-Mail Removed)> wrote in message
news:B88CBD1D-95AA-44A6-9E8F-(E-Mail Removed)...
>I would like to place a botton on a form which will make a backup of the
> entire database or just the tables
>
> Can somone help me with the code or how to make a macro
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Backup database tomf Microsoft Outlook BCM 0 28th Oct 2009 10:06 AM
Unable to open Database Access Backup Database Afreen Microsoft Access 1 12th Oct 2009 06:42 AM
Database Files to be Copied from Backup Image - No BCM Backup Data Jeff Microsoft Outlook BCM 5 6th Jul 2009 08:43 PM
how to take database backup Abhijit Taur Microsoft C# .NET 2 8th Sep 2008 06:48 AM
How to backup database =?Utf-8?B?U2hlZnN0YQ==?= Microsoft Outlook BCM 2 16th Jun 2006 02:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:44 AM.