I have this method which is clicking on an image:
I am using MyDB.mdb in my ADODC components. Could this be the cause this method fails with error message:Code:Private Sub Image7_Click() Dim ref As Reference Dim objaccess As Access.Application Dim errorMsg As String Dim methodName As String methodName = "Image7_Click" On Error GoTo appError StatusBar1.Panels(1).Text = "" Set objaccess = CreateObject("Access.Application") ' fails with error: Microsoft Access can't open the database because it is missing, or opened exclusively by another user., 7866, -1, MSAccess objaccess.OpenCurrentDatabase "MyDB.mdb" ' fails with error: You made an illegal function call., 7952, -1, MSAccess 'For Each ref In objaccess.References 'Debug.Print ref.FullPath 'Next 'objaccess.CloseCurrentDatabase objaccess.DoCmd.Maximize Exit Sub appError: errorMsg = methodName & "(): " & Err.Description & ", " & CStr(Err.Number) & ", " & Err.HelpContext & ", " & Err.Source Debug.Print errorMsg StatusBar1.Panels(1).Text = errorMsg End Sub
If I uncomment the code for printing references to MyDB.mdb, it fails with error:Code:Image7_Click(): Microsoft Access can't open the database because it is missing, or opened exclusively by another user., 7866, -1, MSAccess
I also tired copying MyDB.mdb with other name and then using that other mdb which is not used by my ADODC components. I get still the same two errors I mentioned even with another mdb file.Code:Image7_Click(): You made an illegal function call., 7952, -1, MSAccess
What do i do wrong?




Reply With Quote
