SourceObject with criteria (1 Viewer)

VzqCrs

Member
Local time
Today, 13:27
Joined
Nov 15, 2021
Messages
54
I have a main form (Form A) with a subform embedded (Form B)
When I click a button to open a second form (Form C), gets embedded
Code:
Me.FormB.SourceObject = "FormC"  ' - no problems there

Form C has a double-click event to open the specific form to the record:
DoCmd.OpenForm "FormD", , , "RequestID=" & RequestID, , acDialog

How can I translate the DoCmd.OpenForm code above to behave the same way as Form C?

I tried:
Code:
Me.FormC.SourceObject = "FormD"  'AND
Me.FormB.SourceObject = "FormD"

but I got Compile error: Method or data member not found

I would prefer for it to open over the embedded forms, how can I reference it with a criteria? Is it possible?
 

June7

AWF VIP
Local time
Today, 09:27
Joined
Mar 9, 2014
Messages
5,477
You want to set two subform containers to the same object?

Which line errors?

Where is this code placed?
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 10:27
Joined
Oct 29, 2018
Messages
21,479
Have you tried?

Me.Parent.FormB.SourceObject="FormD"
 

VzqCrs

Member
Local time
Today, 13:27
Joined
Nov 15, 2021
Messages
54
Have you tried?

Me.Parent.FormB.SourceObject="FormD"
I tried both of these and got Run-time error 2465
Application-defined or object-defined error.

I still want to be able to add the "where" so it opens on the record DoCmd.OpenForm "FormD", , , "RequestID=" & RequestID, , acDialog

Code:
Me.Parent.FormC.SourceObject = "FormD"
Code:
Me.Parent.FormB.SourceObject = "FormD"
 

Users who are viewing this thread

Top Bottom