Single table query not populating info

D

dboollu

I have CustomerName query that retrieves the CustomerName, Address, City,
State, and Zip Code from the CustomerName table. CustomerName is a combo
box. How do I get this query to put all the corresponding fields into a form
automatically after selecting a CustomerName from the combo box? Obviously,
I am missing something, because I can't figure it out.

Thanks for any suggestions!!!
 
M

Marshall Barton

dboollu said:
I have CustomerName query that retrieves the CustomerName, Address, City,
State, and Zip Code from the CustomerName table. CustomerName is a combo
box. How do I get this query to put all the corresponding fields into a form
automatically after selecting a CustomerName from the combo box? Obviously,
I am missing something, because I can't figure it out.


For each field that you want to display from the combo box's
row source query, use a text box with an expression like:
=CustomerName.Column(N)
where N is the zero based number of the query's column you
want the text box to display.
 
D

dboollu

Thanks for the suggestion!!

Let me see if I understand you...

You're saying that I create the combobox binding it's record source to the
Query, then create a txt field (like for Address column), and add the
expression CustomerName.Address(2) (dumb qu. but should I use the word
"Column" instead of the actual column name?)in the Control Source property of
the txt box? When I do that all I get is the error "#Name?" in that txt
box. The Customer Name list is fine. If I were to chose "Address" in the
Ctrl Source from the field llist that pops up due to the CustomerName combo
box being bound to the query. In form view an address does appear, but
regardless of wich customer I choose from the combo box it never changes. It
selects the first address in the table.

Did I misinterpret what you said?? Do I need to add an expression to one of
the "Criteria" areas in query design? I don't know if it is trying to select
the whole table and gets confused.
 
M

Marshall Barton

dboollu said:
You're saying that I create the combobox binding it's record source to the
Query, then create a txt field (like for Address column), and add the
expression CustomerName.Address(2) (dumb qu. but should I use the word
"Column" instead of the actual column name?)in the Control Source property of
the txt box? When I do that all I get is the error "#Name?" in that txt
box. The Customer Name list is fine. If I were to chose "Address" in the
Ctrl Source from the field llist that pops up due to the CustomerName combo
box being bound to the query. In form view an address does appear, but
regardless of wich customer I choose from the combo box it never changes. It
selects the first address in the table.

Did I misinterpret what you said?? Do I need to add an expression to one of
the "Criteria" areas in query design? I don't know if it is trying to select
the whole table and gets confused.


A combo box has a RowSource, not a record source.

A text box is a control, not a field.

Don't use the field name. If the combo box is named
Customer, then the text box's control source expression
should be:

=CustomerName.Column(2)
 

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