|
Question : Compact & Repair linked Back end DB Access 2003 error 3356
|
|
I have a front & back end database, when using Access 2000 file format I had no issues using below code to compact and repair the Back end database. When I converted the database to Access 2003 I was able to run the code in the Microsoft Visual Basic editor, however when i run the code using a button on a form I will get an error message:
error 3356, you attempted to open a database that is already opened exclusively by user.....
any suggestions?
Function CompactBackEnd() On Error GoTo Err_CompactBackEnd
Dim ConFileNameBackEndMDR As String Dim ConFileNameCompactTemp As String
ConFileNameBackEndMDR = "c:\File_be.mdb" ConFileNameCompactTemp = "c:\File_beTemp.mdb" DBEngine.CompactDatabase ConFileNameBackEndMDR, ConFileNameCompactTemp Kill ConFileNameBackEndMDR Name ConFileNameCompactTemp As ConFileNameBackEndMDR
Exit_CompactBackEnd: Exit Function
Err_CompactBackEnd: Select Case Err.Number Case 0 Resume Next Case Else MsgBox Err.Number & ": " & Err.Description End Select
Resume Exit_CompactBackEnd
End Function
|
|
Answer : Compact & Repair linked Back end DB Access 2003 error 3356
|
|
I would strongly recommend making sure that there are no bound forms or any recordsets open when you attempt a compact and repair, maybe you could try moving the button to an unbound (to the back end) form e.g. a menu form.
|
|
|
|