Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easiest way to backup a table (for users)? 2

Status
Not open for further replies.

OverDrive

IS-IT--Management
Dec 11, 2000
268
US
What would be the easiest way to create a command button (or similar) that would backup a table?

Reason:
I have a database, the full database information is on one table, I would like to create a command button (or similar, could be a customized toolbar as well) that would allow a user to backup his/her information. I have tried this with the "Analyze with Excel" button, but there is no way (that I know) to import that data back into the database if needed?

Is there any easy way to do this?

Thanks everyone~!
Chance~
 
To where do you wish to back up the table? You could simply copy the table within the database itself. You could also export the table to a text file or spreadsheet.

Once the method has been established, a command button or menu option can be placed so that the backup can be done on command. You could accomplish kicking off the backup through a timer or on load or unload of the database.

Do you need a simple way to import the table back in? If so, do you need to save the old table?
 
Yes, that sounds about what I need to do.

Export to somewhere to back it up, and save it.

Then be able to import it back into the database to be able to use it if needed.

Thanks for the help . . . any Ideas on how to make this process work easiest?

Chance~
 
If you are backing this up for "safety" reasons, it might do no good if the entire .MDB gets corrupted. If that is your reasoning, I would suggest backing up to a new .MDB.

Just food for thought. Call me paranoid... Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
 
A thought...

I have never done this before, but what about using the replication feature of Access to replicate (ie. Backup) data to another database over the network or other device?

That nullify the need for any command button, procedure, or third party tool.

Any comment?

Gary
gwinn7
 
Sounds like it "might" work, but I want this to happen client side, it sounds more like an advanced user function doing something like that. The database is not on a central network, it is user specific. For a user to be able to replicate, they would have to open the database exclusive to be able to do the replicate. I think this would be a little too difficult for my clients to be able to perform.

I am looking for a simple way to backup and/or import one table into a database. Since this is a small database and the core information is in one single table, I would like a real simple way (command button) to be able to perform these operations . . .

Thanks for the idea though, I believe it would work, just a little difficult.

Thanks
Chance~
 
Overdrive
Below is a function to backup a back-end database to a separate folder. It resides in a module on my front-end and is called from a button on my switchboard. You can't run it directly from the database you are backing up, but you might be able to adapt it for your purposes.

=====================================================
Code:
Public Sub Backup()
'This function backs up to the g: drive, you can back up to any location,
'just change the strDest Value
On Error GoTo Err_Backup
    Dim db As Database
    Dim strSource As String, strDest As String, strError As String
    Dim strDate As String, strDateX As String

    If MsgBox("Are you sure you want to back up data?", vbQuestion + vbYesNo, " Continue with Data Back-Up?") = vbYes Then
'Un-comment the following 3 lines for a new backup for every day
'strDate = Format(Date, "mm/dd/yy")
'strDateX = Left(strDate, 2) & Mid(strDate, 4, 2) & Right(strDate, 2)
'strDest = "a:\" & strDateX

        Set db = CurrentDb()
        DoCmd.Hourglass True

'Put any table name in here that exists in your back-end
        strSource = db.TableDefs("trkTracker").Connect
        strSource = Mid(strSource, 11, Len(strSource) - 10)

'If you are using a new back-up every day, un-comment this line and replace the database name, and comment out the next line down
'strDest = strDest & "_YourBackEndDBNameHere.mdb"

'Replace with your database Back-end name
        strDest = "g:\Debt Management\DMU Tracker\Back-Up 
Files\Legal Tracker Data Backup.mdb"
'Copy the file
        FileCopy strSource, strDest

        db.Close

        DoCmd.Hourglass False
        MsgBox ("Backup to " & vbNewLine & strDest & vbNewLine & " is Complete")
    End If

Exit_Backup:
    Exit Sub

Err_Backup:
'Display appropriate Error Message
    Select Case Err.Number
    Case 61
        strError = "Floppy disk is full" & vbNewLine & "cannot export mdb"
        MsgBox strError, vbCritical, " Disk Full"
        Kill strDest
    Case 70
        strError = "File is open" & vbNewLine & "cannot export mdb"
        MsgBox strError, vbCritical, " File Open"
    Case 71
        strError = "No disk in drive" & vbNewLine & "please insert disk"
        MsgBox strError, vbCritical, " No Disk"
    Case Else
        Err.Raise Err.Number, Err.Description
    End Select

    DoCmd.Hourglass False
    Resume Exit_Backup

End Sub
=========================================================
Hope this helps

Lightning
 
Thanks for all the help guys, but I think you mis-understood me. I need to backup a table from an .MDE file, not an .MDB.

All I need to do is to have the ability for users to backup the records in their database. This is a user who does not have any user rights or priveledges to modify the .mdb.

I need an easy way for a "mickey mouse" user to be able to back up his/her records that are in the one table where all the information happens to be, and also be able to reload that information once it has been backed up if needed.

Any simple way?
Anyone?

Thanks for the help guys!

Chance~
 
Can you use a Make-Table query to backup all the data from the table to another name? That would be the quickest and easiest if it needs to be only one table.

HTH

Lightning
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top