How to refrence a textbox in subform

Milad

Registered User.
Local time
Today, 03:33
Joined
Jul 8, 2013
Messages
27
I would be thankful if anyone help me reference a text box in sub form. I did the same thing for the combo box in it worked perfect. I am not sure why this is not working for textbox.
This is how I referenced it:
[Forms]![MainOrderForm]![CuttingNumForm].[Form]![Style1]
Form: MainOrderForm
Sub Form: CuttingNumForm
Text Box: Style1
I should also mention that "Style1" filed in automatically once a "CuttingNum" field is selected.

Thanks in advance for your help
 
Where are you referencing from? Another form or report, a query or the main form which hosts the subform?
 
Thanks for your quick response.
I have a form which contains two sub forms. In the first subform I have 4 fields of Cut#, Size, Quantity and Style. Once the cut# is selected, a vba code runs and fill in the rest of fields.
In second sub form I have a field of Fabric# (Combo Box) which should be restricted to the “Style” value on the first sub form. I have a query which contains the Fabric# and Corresponding style and I try to write a vba code to requery once “Style value” changes. I
 
In fact, I want to reference the "Style" field in the query which gives me the "FabricNum"
 
To reference the value in another subform in the same mainform you reference as follows:
Code:
Me.Parent.SubformCtrlName.Form.style1
Note the SubformCtrlName is the name of the control, not the name of the subform used as its source object

For future reference

Me.Parent looks 'up' one level
Me.Parent.Parent looks 'up' two levels etc
 
In your original post you said

This is how I referenced it:
[Forms]![MainOrderForm]![CuttingNumForm].[Form]![Style1]
so it used where you are currently trying to use the bit I have highlighted in red - basically you are replacing

[Forms]![MainOrderForm]!

with

Me.Parent.
 
Did you mean in the query's criteria? Because that's where I had my previous code.
 
Try this:
on the AfterUpdate() event of the style textbox, put in your event procedure
Code:
[COLOR=#ff0000]Forms!MainOrderForm!CuttingNumForm.Form!Style1.requery[/COLOR]
 

Users who are viewing this thread

Back
Top Bottom