Hi,
I have the following code where I make an copy of my database that I use. the code executes 100% but the problem I have is I'm not able to access my database afterward.I get a "Cannot start your application. The workgroup information file is missing or opened exclusively by another user." and so if I restart the application it all works fine again.
I'm certain the reason is because I can only access that database using a specific account name and password which is not account I'm logged in with.
What i want to try is to default that database mdb to the point where no user is accessing it, or to reassign the the only account name that can access it to that database mdb.
Any ideas, will be enormously appreciated? I've tried playing around with file security but had no luck.
Private Sub cmdBackup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdBackup.Click
BackupDialogDB.DefaultExt = ".mdb"
BackupDialogDB.InitialDirectory = "c:\"
'SaveFileDialog1.ShowDialog()
If BackupDialogDB.ShowDialog() = Windows.Forms.DialogResult.OK Then
Try
Dim sDBFile As String = Application.StartupPath + "\VFMS_DB.mdb"
Dim sBackUpFile As String = BackupDialogDB.FileName
'First check the file u want to compact exists or not
If File.Exists(sDBFile) Then
If Not File.Exists(sBackUpFile) Then
File.Copy(sDBFile, sBackUpFile)
Else
File.Delete(sBackUpFile)
File.Copy(sDBFile, sBackUpFile)
End If
MessageBox.Show("The database was successfully backedup to: " + sBackUpFile , "Database Backedup", MessageBoxButtons.OK, MessageBoxIcon.Information)
sDBFile = ""
Else
MessageBox.Show("There is no database to backup. Please restore from a backup", "Database Backup Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End Sub