Closing DB File - Please Help - Urgent

mike_2881
06-04-2003, 09:35 AM
Below is my code. I'm getting an error saying Invalid Qualifyer when I set mydb = "C:\My Documents\Programming\Bennett Auto Rebuilders\Database.mdb". What am I doing wrong?

Private Sub mnuBackupRunBackup_Click()

Dim mydb As String
mydb = "C:\My Documents\Programming\Bennett Auto Rebuilders\Database.mdb"
mydb.Close
Set mydb = Nothing
FileCopy "C:\My Documents\Programming\Bennett Auto Rebuilders\Database.mdb", "C:\Bennett Backups\Database.mdb"

End Sub

Please Help!

jayceepoo
06-04-2003, 10:08 AM
You're problem is that you are trying to use a .Close function on a String variable.

mike_2881
06-04-2003, 10:16 AM
What is the correct code?

Thanks!

DerFarm
06-04-2003, 11:55 AM
Somewhere in your program, you have presumably opened the database as a connection object. The connection object is the thing you have to close.

mike_2881
06-04-2003, 12:11 PM
Thank you DerFarm.

What would be the code I used to do this?

jay_jay
06-04-2003, 01:14 PM
Thank you DerFarm.

What would be the code I used to do this?

I don't know which version of VB you have but this is one way to connect to an Access database from VB6 Enterprise addition.

:D

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum