I have a mainform in MS Access 2010. In it are two subforms, which are linked together. One of the subs is a "single form", the other a "datasheetview". On the upper Sub, the user can see the details of the record, which is choosen in the sub below. It works fine.
I want open this Access-App from an other Access-App, open the mainform and go to a specific record. Here is the code:
Dim appAccess As Access.Application
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase "C:\xxx\xxx\Desktop\MyAccess.accdb"
appAccess.DoCmd.OpenForm "subGridView", , , "[Number_X] = '" & Me.number_for_X.Value & "'"
It works, but I open the subform, which is below in the MAIN. I think I need something like this:
Dim appAccess As Access.Application
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase "C:\xxx\xxx\Desktop\MyAccess.accdb"
appAccess.DoCmd.OpenForm "MAIN"
appAccess.DoCmd.GoToRecord acDataForm, "subGridView", acGoTo, 37
37 is only a test-parameter...
Or something like:
Dim appAccess As Access.Application
Dim rNr As String
Set appAccess = CreateObject("Access.Application")
rNr = Me.number_for_X.Value
appAccess.OpenCurrentDatabase "C:\xxx\xxx\Desktop\MyAccess.accdb"
appAccess.DoCmd.OpenForm "MAIN"
Forms!subGridView.Recordset.FindFirst "[Retoure_Nummer] = '" & rNr
Set appAccess = Nothing
Please give me some hints :-)
Greetz Vegeta_77