Putting a value from a combo box into a text box on a form 
Author Message
 Putting a value from a combo box into a text box on a form

I want to retrieve a value from a combo box and make it display in a text
box on the same form.

The Combobox does not have a Control Source property, it gets its values
from a query.  The query returns several fields, only some of which are
displayed in the Combobox. I want to display one of the hidden fields in the
text box.

If I try to reference one of the fields from a textbox using the following
expression as the Control Source for the text box :

    =[cboCombobox].[lname]

I get "#Name?' in the text box. However, if I just use:

    =[cboCombobox]

Then I get the value for the first field in the query underlying the
Combobox.

How can I get the textbox to return the value of the 3rd field (hidden) from
the Combobox's query??

Thanks for any ideas.
Dave

--------
David R. Frick & Co., CPA
http://www.*-*-*.com/




Tue, 19 Dec 2000 03:00:00 GMT  
 Putting a value from a combo box into a text box on a form

david,
try this
=[cboCombobox].column(2)

not that numbering here is 0 based, thus 2 is the third item

regards,
TomG



Tue, 19 Dec 2000 03:00:00 GMT  
 Putting a value from a combo box into a text box on a form

Thanks Tom.  That works just fine.

To make sure I understand, is it true that when I reference a value in a
control whose Row Source property is a query, I  must refer to the specific
column in that control.  It is not possible to reference the value based on
a fieldname used in the query?

Thanks again,
Dave

Quote:

>david,
>try this
>=[cboCombobox].column(2)

>not that numbering here is 0 based, thus 2 is the third item

>regards,
>TomG



Tue, 19 Dec 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Save Text Boxes Values To Combo Box's Item

2. enter data in a combo box based on value from another combo box

3. Created Form in Word - Irregular movement of combo boxes, text boxes on scrolling

4. HELP Forms, combo boxes, text boxes

5. populate text box from combo box (same form)

6. Limiting Access to Text Boxes, List Boxes and Combo Boxes

7. How to put value in text box

8. Clearing the text value of a combo box

9. Unable to populate text box from combo box

10. Filling combo box text box area from data

11. Adding to a combo box or text box through the keyboard

12. Combo Boxes and Text Boxes

 

 
Powered by phpBB® Forum Software