edrz01
asked on
Unable to reference a control field in a subform
I have a procedure that needs to check a control field in a subform (subfrm_Orders). The field is a Boolean yes/no in the subform for the field Select_Order.
Currently I am using:
Dim strPurchaserEmail As Variant
Dim strOrderSelect As String
strPurchaserEmail = Forms!frm_CustomerOrders!e Mail
strOrderSelect = Forms!frm_CustomerOrders.s ubfrm_Orde rs.Forms!S elect_Orde r
The first DIM is working fine in the Main form frm_CustomerOrders.
However, I am receiving the following when attempting to get the subform:
Run-time error '2465' Application-defined or object-defined error
I have tried String, Variant and Boolean
The field will be used to check if it is True to continue with the procedure to the next step.
Currently I am using:
Dim strPurchaserEmail As Variant
Dim strOrderSelect As String
strPurchaserEmail = Forms!frm_CustomerOrders!e
strOrderSelect = Forms!frm_CustomerOrders.s
The first DIM is working fine in the Main form frm_CustomerOrders.
However, I am receiving the following when attempting to get the subform:
Run-time error '2465' Application-defined or object-defined error
I have tried String, Variant and Boolean
The field will be used to check if it is True to continue with the procedure to the next step.
ASKER
I have set strOrderSelect = Me!subfrm_Orders.Form!Sele ct_Order and receive the error message: can't find the field 'subfrm_Orders' referred to in your expression.
--subfrm_Orders is the name of the subform.
--subfrm_Orders is the name of the subform.
strOrderSelect = Forms!frm_CustomerOrders.f orm!subfrm _Orders.Fo rm!Select_ Order
like this:
Me!Subform1.Form!Subform2. Form!Contr olName
like this:
Me!Subform1.Form!Subform2.
Then 'subfrm_Orders' isn't the name of the control.
ASKER
have you tried my suggestion?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Arana, Gustav and Pat....
Thank you for your direction. I guess I did not fully understand the Control Source and mistook the Sub Form name as the Control. Which it isn't.
Pat, your first sentence opened my eyes that I was looking at the incorrect naming and concentrated on the name "subfrm_Orders" which is the Source Object and not the Control Name "Orders". I'm glad to have added the Property image to clear this up.
I used:
strOrderSelect = Me!Orders.Form!Select_Orde r
Arana - your post "Subform1.Form!Subform2.Fo rm!" I did not fully understand the use of two Subform1 and Subform2
Gustav - your post "'subfrm_Orders' isn't the name of the control. " had me trying to figure out what the name was...
So, that's that. I'd like to give you all credit for pointing me in the right direction.
Thank you for your direction. I guess I did not fully understand the Control Source and mistook the Sub Form name as the Control. Which it isn't.
Pat, your first sentence opened my eyes that I was looking at the incorrect naming and concentrated on the name "subfrm_Orders" which is the Source Object and not the Control Name "Orders". I'm glad to have added the Property image to clear this up.
I used:
strOrderSelect = Me!Orders.Form!Select_Orde
Arana - your post "Subform1.Form!Subform2.Fo
Gustav - your post "'subfrm_Orders' isn't the name of the control. " had me trying to figure out what the name was...
So, that's that. I'd like to give you all credit for pointing me in the right direction.
strOrderSelect = Me!NameOfSubformControl.Fo
/gustav