Access - Get ID of Subform

Hi

I am using the following code to get the selected ID in the subform shown in the image and open another form with this ID. The first
part works fine but for some reason the "Invoices" form is not opening at that ID

    Dim oID As Long
        oID = Me.Invoices_Summary.Form!ID

    'The following line does not work properly
    DoCmd.OpenForm "Invoices", acNormal, , , acFormPropertySettings, acWindowNormal, oID

Open in new window

Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?
 
Gustav BrockConnect With a Mentor CIOCommented:
It should read:

DoCmd.OpenForm "Invoices", acNormal, , , acFormPropertySettings, acWindowNormal, "ID = " & oID & ""

Open in new window


where ID is the name of your ID field.
0
 
John TsioumprisSoftware & Systems EngineerCommented:
at first check that there is a control named ID..
also try this
Form_Invoices.ID
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks Gustav
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.