Reference a field in a subform

G

Guest

I have an application that works fine as is. What I'm doing is adding tabs to
a new form and dropping the previously created form on one of the tab pages.

The following line works fine on the old form:

If Forms![Bank]![Creditor] = False Then
[Debit_Label].Caption = "Debits"
[Credit_Label].Caption = "Credits"
Else
[Debit_Label].Caption = "Charges"
[Credit_Label].Caption = "Payments"
End If

When I drop this form into the tab control, page1, the reference no longer
works. It tells me it can't find the field 'Bank'.

What do I need to change to have this reference work?
 
G

Guest

To reference a field in a subform, the path should be

Forms![MainFormName]![SubFormNameWithinTheMainForm].Form![FieldName]
So if you had this line
Forms![Bank]![Creditor]
It will change to
Forms![MainFormName]![Bank].form![Creditor]
Assuming that the sub form frame within the main form called Bank


When the MainForm is open you can use the builder to create the path for you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top