Help plz. How do i backup a database with code?

bjsteyn

Registered User.
Local time
Today, 02:43
Joined
May 15, 2008
Messages
113
Help plz! How do i backup a database with code? And is their any i can update fields with docmd.RunSQL without the update message comin up?bj
 
You can update by setting

DoCmd.SetWarnings False
then your
DoCmd.RunSQL " "
then
DoCmd.SetWarnings True

Daz
 
Simple Software Solutions

Please see attached file on how to backup an mdb by first compacting it first (optional) and then compacting it to a zip file.

Make sure you read the attached notes first.

CodeMaster::cool:
 

Attachments

Thanx DDaddy and DCrake. Can u maby help me with one more thing. I put in a "previous" and "next" button ,using docmd.gotorecord,so u can scroll threw ur customers. How do i check if the current record is the first or last so that i can disable previous and next accordingly.thanx bj
 
Hi bj.

Try adding this to the next button.

With recordset
If .AbsolutePosition = .RecordCount - 1 Then
'you are on the last record
me.nextbutton.visible = false
Else
'you are on some other record
me.nextbutton.visible = true
DoCmd.GoToRecord , , acNext
End If
End With
 
Hy ddaddy. Thanx 4 replying again. Where r u from? I'm working on my first database. I have sum vb6 experience.The database i'm designing is 4 sumbody who is starting up a business and want to use it to manage customers, orders,products,stock etc. The Northwind database helped me alot. I am almost finished with my DB. can i upload a copy and u can check it out and let me know where i can inprove. Hav 3 more questions. 1)How do u check if the form on load returnes zero records from its recordsource. 2)how do i delete a record from a form. 3)why does fields in a query lockup when u add a sum field. Eg. In my first query i hav 3 fields that calculate the "taxable amount","vat" and "total" 4 each product in an order. In next query i calcute the "totaltaxable","totalVAT","GrandTotal" for a order by summing the values in previous query , but i also have fields named "Paid Date" ,"Paid Amount" etc. in which lock up because of the sum fields. Thanx bj
 
Please see attached file on how to backup an mdb by first compacting it first (optional) and then compacting it to a zip file.

Make sure you read the attached notes first.

CodeMaster::cool:

Hi All,

This is something I have wanted to add to a dtatbase for a while and it seems too simple. Too bad I can't get it to work.

I'm very much a novice and would really appreciate help here. I've added the coding in the attachement to mt function library. I have added a button on the front page of my database with the "OnClick" set to event "Call CreateZipFile"

When I press the "Backup Button" created I get an error message which goes straight into VB with the two sections below mentioned as a problem.


Function GetBackUpInfo() <= Highlighted in Yellow
Dim DB As DAO.Database <=DB As DOA.Database highlighted blue
Set DB = DBEngine(0)(0)
SysDataPath = DB.Properties![DataPath]
SysMDBName = DB.Properties![BackEnd]
End Function

Any assistance greatly appreciated. I hope I followed the instructions supplied in the zip file correctly.

Cheers.
 
Simple Software Solutions

You need to add the Microsoft DAO 3.6 Object Library to your references Via Tools > References.

If you have not got 3.6 use the one you have got.

David
 

Users who are viewing this thread

Back
Top Bottom