Link to home
Start Free TrialLog in
Avatar of prowler2
prowler2Flag for United States of America

asked on

Assigning a subform to a variable using VBA

I am trying to compare a value on the main form with the value  on a subform.   I have assigned the main form to a variable and it works fine (see below):

Dim strParent As String, strCPersonal As String
Let strParent = [Forms]![frmempinfo]![EmpNumber]

Then, I assign the subform to a variable and  I receive the error that MS Access is unable to find the form.  Make sure it is spelled correctly and that it exists.

Let strCPersonal = [Forms]![frmChildPersonal]![EmpNumber]

frmChildPersonal is what I named the subform via the main form.  The actual name of the form is frmDISPersonal.  I tried to replace that with the frmChildPersonal and I received the same error message.

~CJ~
ASKER CERTIFIED SOLUTION
Avatar of jadedata
jadedata
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of prowler2

ASKER

Thank you.  I will try this.  I haven't been to this site in a while.  Did they stop the emailing of expert responses?
-CJ
The responses are not emailed,...only notification that a question has had a comment posted to it.
Avatar of stevbe
stevbe

No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: jadedata {http:#9741751}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

stevbe
EE Cleanup Volunteer