Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform Field Question

Status
Not open for further replies.

avagodro

Technical User
Aug 12, 2005
83
US
I have a form with a subform linked. In the form, there is a field "txtFields" that I want to have as a condition in my subform.
Basically, [txtFields] will either be Text or Combo. If it is Text, then a Textbox will be visible in the subform. If Combo, then a Combobox will be visible.

I have tried creating a hidden field on my subform with a default value of =[frmMain]![txtFields] but I keep ending up with a Name? error. I had named the textbox on my subform as txtFields1

The code that I have written that will display the appropriate type of control is:

if Me.txtFields1 = "Text" Then
Me.Text1.Visible = True
Me.cbo1.Visible = False
Else
Me.Text1.Visible = False
Me.cbo1.Visible = True
End If

My problem is with the txtFields1 textbox, or even being able to have the code check the [txtFields] control from frmMain

Any suggestions?

 
Never mind. I was able to resolve the issue. It was a matter of the name of the subform
 
How are ya avagodro . . .

Try this:
Code:
[blue]=Forms![frmMain]![txtFields]
or
=[Parent]![txtFields][/blue]

Calvin.gif
See Ya! . . . . . .
 
Not doing too bad. The problem that I was having turned out to be the name of the subform. I had thought that I had named the "control" the same as I did the actual subform. I was sadly mistaken. As soon as I changed it to the proper subform control name, it worked fine.
Learn something new every day. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top