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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with referring to a textbox in a subform

Status
Not open for further replies.

leaners

Technical User
May 16, 2006
12
AU
I have a main form (called Rooms Available) with a listbox (called list0) in it.
There is a subform(called Room subform) in the main form.
The subform has a textbox (called roomno) in it.

The listbox displays a query. The code needs to copy the selected data in the listbox when the user clicks on the listbox and put that data into the textbox.

I want to use:

Private Sub List0_Click()
Me.ReferToTextboxInSubform = Me.List0
End sub

The problem is I do not know how to refer to the textbox in the subform. I know the syntax is:

Forms![main form name]![subform control name].Form![control name]

But either it wont work with the Me or im doing it wrong. I tried:
Me.Forms![Rooms Available]![Room subform].Form![Roomno] = Me.List0

This gives an error "method or data member not found"
Can you please tell me the correct code?
 
I have found the answer to my question already.
The right code is:

Me![Room subform].Form.Roomno = Me.List0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top