|
-
Feb 6th, 2002, 10:06 AM
#1
Thread Starter
New Member
-
Feb 6th, 2002, 11:36 AM
#2
Fanatic Member
You could use this. This is the compact routine but can act as a sort of backup
Make sure you reference the Microsoft ADO Ext. 'Version' for DDL and Security.
VB Code:
Dim je As New JRO.JetEngine
' Make sure there isn't already a file with the
' name of the compacted database.
If Dir("C:\BackUp\YourDB.mdb") <> "" Then Kill ".\NewNorthWind.mdb"
' Compact the database
je.CompactDatabase "Data Source=C:\YourDB.mdb;Jet OLEDB: Database Password=password;", _
"Data Source=C:\BackUp\YourDB.mdb;"
Gary Lowe 
VB6 (Enterprise) SP5
ADO 2.6
SQL Server 7 SP3
OK I know my spelling and grammer is crap so don't quote me on it!
To err is human to take the P! is only natural !!
Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip

-
Feb 6th, 2002, 11:40 AM
#3
Thread Starter
New Member
-
Feb 6th, 2002, 04:02 PM
#4
Hyperactive Member
you could use a timer
you could place a timer control on a hidden form. This form should also display a label control which tells the user that a backup is taking place, and to wait. Place something like this on your hidden form:
------------------------
Dim i As Byte
Private Sub Form_Load()
i = 0
End Sub
Private Sub Timer1_Timer()
i = i + 1
If i = 60 Then
Form1.Show vbModal
Timer1.Enabled = False
'1. disconnect from the databse
'2. compact or copy database
'3. reconnect to databse
i = 0
Timer1.Enabled = True
Form1.Hide
End If
End Sub
-----------------------------
note that the timer control is kinda unreliable and that it is better to use the windows api functions.
this is just an idea, sorry i can't give exact code.
well gotta i go study now, good luck.
-
Feb 6th, 2002, 04:05 PM
#5
Hyperactive Member
sorry i forgot to mntion that your timer interval should be set to 60000, so that it will go off every minute.
-
Feb 6th, 2002, 04:13 PM
#6
Hyperactive Member
Why not replicate your database, then set a timer to go off every hour and synchronise the two. You do not need to disconnect any users, as you would for compacting, as the synch process can be carried out on open and active databases.
Graham, www.gab2001uk.com VBExplorer Forum Moderator VBExplorer
www.gab2001uk.com For comparing and contrasting DAO with ADO
Code for Creating, Copying, Compacting, Replicating, Synchronising Access 97/2000 databases plus showing Schemas and using .Seek
-
Feb 6th, 2002, 04:26 PM
#7
Hyperactive Member
Here 2 projects that do just that. One uses DAO the other ADO / ADOX / JRO.
Have fun
Graham, www.gab2001uk.com VBExplorer Forum Moderator VBExplorer
www.gab2001uk.com For comparing and contrasting DAO with ADO
Code for Creating, Copying, Compacting, Replicating, Synchronising Access 97/2000 databases plus showing Schemas and using .Seek
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|