|
-
Nov 16th, 2009, 02:00 AM
#1
Thread Starter
Member
[RESOLVED] Back-up and restore using DAO,Acces as Database,vb6 application
Hello Experts,
I got an error while backing up ms access database using vb6.0, the error is "Cannot start your application. The workgroup information file is missing or opened exclusively by another user."..I have no idea about this, I'm using DAO and common dialog to saved mdb file..please help
Thanks,
-
Nov 16th, 2009, 02:13 AM
#2
Re: Back-up and restore using DAO,Acces as Database,vb6 application
-
Nov 16th, 2009, 04:51 AM
#3
Thread Starter
Member
Re: Back-up and restore using DAO,Acces as Database,vb6 application
 Originally Posted by dee-u
How are you doing it?
Thanks for the reply
I have 1 command button called "Back up Database", When I click it, common Dialog appear to save .mdb file,but there's no error appear, but in the Immediate window there is a log ""Cannot start your application. The workgroup information file is missing or opened exclusively by another user."",..and also no data saved in the folder...
Here's my code :
Dim myDatabasePath As String
Dim strFileName As String
myDatabasePath = "D:\Information.mdb" ' my original db file
With CommonDialog1
.Filter = "MS Access DB File | *.mdb"
.ShowSave
If Len(.FileName) > 0 Then
strFileName = .FileName
Else
Exit Sub
End If
End With
On Error GoTo Err
Dim Conn As New DAO.DBEngine
Dim strSource As String
Dim strDest As String
SetAttr myDatabasePath, vbNormal
strSource = "DataSource=" & myDatabasePath & ",Username=Admin;Password=admin;,"
strDest = "DataSource=" & strFileName & ",dbengine(0)"
Conn.CompactDatabase strSource, strDest
Set Conn = Nothing
Exit Sub
Err:
Debug.Print Err.Description
Thanks,
Last edited by ryanbesitulo; Nov 16th, 2009 at 04:55 AM.
-
Nov 16th, 2009, 09:09 AM
#4
Re: Back-up and restore using DAO,Acces as Database,vb6 application
 Originally Posted by ryanbesitulo
there's no error appear, but in the Immediate window there is a log ""Cannot start your application. The workgroup information file is missing or opened exclusively by another user.""
Due to the error handler you have got, that clearly is an error appearing - you have just chosen to re-direct the message to the Immediate window rather than the screen.
It has been many years since I used DAO, so I don't know exactly what .CompactDatabase expects... but I suspect the values you have got in strSource and strDest are not quite right.
Another possible issue is that one (or both) of the databases might currently be in use, but I would expect a different error in that situation.
-
Nov 16th, 2009, 09:07 PM
#5
Thread Starter
Member
Re: Back-up and restore using DAO,Acces as Database,vb6 application
 Originally Posted by si_the_geek
Due to the error handler you have got, that clearly is an error appearing - you have just chosen to re-direct the message to the Immediate window rather than the screen.
It has been many years since I used DAO, so I don't know exactly what .CompactDatabase expects... but I suspect the values you have got in strSource and strDest are not quite right.
Another possible issue is that one (or both) of the databases might currently be in use, but I would expect a different error in that situation.
Thanks for the reply..
I Changed the code on how to back-up...but i got an error, said that "Permission denied"
Here's my code:
Private Sub Back_Click()
Dim Conn as new ADODB.Connection
Dim Source As String
Dim Destination As String
Source = App.Path & "\Pensioner.mdb"
Destination = App.Path & "\Backup\" & Format(Date, "mmmm dd, yyyy") & " " & Format(Time, "h_mm_ss") & ".mdb"
FileCopy Source, Destination
MsgBox " Backup Successfully Saved!", vbInformation, ""
Conn.Open
End Sub
Thanks,
-
Nov 16th, 2009, 11:02 PM
#6
Thread Starter
Member
Re: Back-up and restore using DAO,Acces as Database,vb6 application
 Originally Posted by ryanbesitulo
Thanks for the reply..
I Changed the code on how to back-up...but i got an error, said that "Permission denied"
Here's my code:
Private Sub Back_Click()
Dim Conn as new ADODB.Connection
Dim Source As String
Dim Destination As String
Source = App.Path & "\Pensioner.mdb"
Destination = App.Path & "\Backup\" & Format(Date, "mmmm dd, yyyy") & " " & Format(Time, "h_mm_ss") & ".mdb"
FileCopy Source, Destination
MsgBox " Backup Successfully Saved!", vbInformation, ""
Conn.Open
End Sub
Thanks,
Yes.... I got it
Thanks both of you..
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
|