I have two forms, the main form has a button that opens another form. When it does this, it sets the value of two fields in frm2:
Now, the OnClose event for frm2 is this:
Obviously, this throws the error "Cannot find form "formName".
How can one refer to a form and field programmatically using variables?
thanks
Information is not Knowledge, Knowledge is not Wisdom, Wisdom is not Truth, Truth is not Beauty, Beauty is not Love, Love is not Music, Music is the best.
Code:
DoCmd.OpenForm "frm2", acNormal
Forms!frm2![form_name] = "frm1"
Forms!frm2![field_name] = "field1"
Code:
Dim formName As String
Dim fieldName As String
formName = Me![form_name]
fieldName = Me![field_name]
Forms![formName]![fieldName] = Me![field2]
Obviously, this throws the error "Cannot find form "formName".
How can one refer to a form and field programmatically using variables?
thanks
Information is not Knowledge, Knowledge is not Wisdom, Wisdom is not Truth, Truth is not Beauty, Beauty is not Love, Love is not Music, Music is the best.