How do I use a selection imade n a combo box appear in a textbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to display customers information in a text box. The information will
be automatically displayed in the text box when the customers ID number is
selected from a separate drop down list. I have the customers ID in the combo
box based on a quire but I cannot figure out how to build the proper
expression to show the customers information (name, address, city…etc.) in
the separate text box. Any suggestions? This is for an assignment and using a
subform to display the results is not acceptable. My every attempt results in
#Name?. The closest I have gotten is using a combo box to list the
information and then having the Customer ID combo box be the control source.
 
In the RowSource Property of the combo create the SQL that includes all the
fields you want to display in the form when a customer is selected

Select Id,Address,phone,fax, City, State From Customer

Now, you have to option to spread the data in the text boxes
1. On the after update event of the combo you can write the code
me.addressTextBoxName = me.comboName.column(1)
me.phoneTextBoxName = me.comboName.column(2)
me.faxTextBoxName = me.comboName.column(3)

To get the data you specify the column + location , strting with 0

===============================================
2. On each Text box, in the ControlSource Property, you write the location
in the combo
For the address Field you write
=me.comboName.column(1) ===============================================
You can also combine few fields into one
Address + City + State
= me.comboName.column(1) & " " & me.comboName.column(4) & " " &
me.comboName.column(5)

===============================================
I hope that helped
 
Back
Top