Open Form in Database B From Form in Database A

wezhogan

Registered User.
Local time
Today, 10:00
Joined
May 24, 2012
Messages
16
I am having a problem openning a form in database B from a form in database A. I know the issue has to do with database A being open when openning database B. There is a table in database B that is linked to database A. Is there anyway to relinquish control in database A when trying to open database B? Here is the code I am using:

Here is the code for the form in database A:

Private Sub bnClose_Click()
Dim strDatabasePathAndName As String
Dim strFormToFloatName As String

strDatabasePathAndName = "C:\Users\New Beginnings\Desktop\Louise Drafts\ClientInformation.accdb"
strFormToFloatName = "frmForms"

Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase strDatabasePathAndName
appAccess.Run "InvokeCommand", "OpenForm", strFormToFloatName
appAccess.Visible = True

DoCmd.Close acForm, "frmSummaryReport", acSaveYes
End Sub

Here is the code for the module in database B:

' Called from the external Application.
Public Sub InvokeCommand(ByVal strCommand As String, _
ByVal strArgument As String)

Select Case strCommand
Case "OpenForm"
DoCmd.OpenForm FormName:=strArgument


Case Else
MsgBox "Invalid Command Passed to InvokeCommand"

End Select
End Sub

When I get the errors it says:

Runtime error 3734
"The database has been placed in a state by user "ADMIN" on machine "PC" which prevents it from being openned or locked."

Runtime error 440
"Method 'Run' of object_'Application' failed.

Then other times it just opens the database and closes it right away.
 

Users who are viewing this thread

Back
Top Bottom