Unanswered: Access VBA referencing controls between forms
So I am still learning VBA in Access and I can not seem to find the syntax to reference form controls other than with "me"
For example, I have a dialog form open (Form 1). I press a button on Form 1to open a second form (Form 2). There is a button on Form 2, once I press that, I want Form 2 to close another form (Form 3) to open. So many forms!
My problem is, that when form 2 closes and opens form 3, I want it to reference the ID from form 1 (Form 2 is essentially a warning message form that the user needs to acknowledge), but I don't know the syntax to do this...
But the me doesn't work because that "me" control is actually on Form 1, not Form 2. I have tried some of the below with no luck. If anyone can shed some light on the proper way to do this, I would greatly appreciate it.
Also, if another explanation is needed, I would be happy to explain another way and/or in more detail.
This is because a form is not added to the Forms collection when it is open as a subform. You can only reference it through its parent form (i.e. the main form).
Either you create the property on the main for, but like this:
Public Property Get SomeProperty() As Variant
SomeProperty = Me.SubFormName.Form.ControlName.Value
Public Property Let SomeProperty(Value As Variant)
Me.SubFormName.Form.ControlName.Value = Value
Or the property remains in the subform module but you reference it like this: