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

Query as control source for text box question

Status
Not open for further replies.

awingnut

Programmer
Feb 24, 2003
759
0
0
US
I have a query set up that works correctly when in datasheet view. My problem is getting the various columns into text boxes. I set the control source to the query name and column name using the expression builder. However, in form view each text box says #Name?. What do I need to do to get the data displayed? Also how do I specify which record (I always want the first one since it is propery sorted) to use? TIA.
 
I'm not in front of my Access PC so some of my terminology may be a bit out, but if you look at the ALL tab of your properties, for any Text box you will have it's name property and below it should be the name of any bound field. IF you have a record source set for the form, you shouldn't need the expression builder, your text box should be set to get it's data from a field name (bound form is what you want I guess)and to the right of the text box data source should be a few full stops '...' using your mouse on these should get this to drop and list all the available fields from the record source, pick the one you want. The text box will then be 'bound' to that field. You will also want the navigation buttons I guess, so you can move back and forth between records.
 
Thanks for the reply. That is not quite the case. There is no record source for the form because the fields on it need to be filled in by a couple of different queries. The problem is I cannot bind each form text box to its respective query column. No navigation is needed because I only want the values from first record of the sorted query recordset.

I can do it using code in the form 'open' subroutine but I don't see why I need to go to that trouble. This is what Access was designed to do.
 
I finally figured it out. Just to close this question the solution is to use Dlookup in the control source expression:

=Dlookup("Fieldname","My Query Name")

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top