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

Populating fields based on a combo box 1

Status
Not open for further replies.

temp

Programmer
Feb 15, 2000
2
CA
this is a stupid question, but how do I populate other fields on a form based on a combo box? the data comes from table1, and will be seeded into table2, based on the value in combo1. I figure I'll need a select whatever from table1 where value=combo1, but do I need a recordset or something to put the data in, and how do I get the data seeded into each field? TIA...
 
Well to get the value of a combo box it based on the columns in it<br>
Say you have CustID in the first column and Name in the second, and Phone last<br>
then to get the<br>
CustID<br>
= combo1.columns(0)<br>
Name<br>
= combo1.columns(1)<br>
Phone<br>
= combo1.columns(2)<br>
<br>
So if you wanted to put CUSTID in a textbox<br>
Me!Text1 = combo1.columns(0)<br>
<br>
Now when you select the combo you want to pick your customer and have that info go in your text box <br>
Put the above line in the &quot;Combo1_after update&quot; event like this.<br>
<br>
Private Sub Combo19_AfterUpdate()<br>
Me!Text1 = Combo1.columns(0)<br>
End Sub<br>
Open form in design view<br>
Double Click the Combo box, find the AfterUpdate event and click the in it and find &quot;Event <br>
<br>
Procedure&quot;<br>
then click the &quot;3 dots button&quot; which will bring up the code window paste this line in the middle<br>
<br>
Me!Text1 = Combo1.columns(0)<br>
<br>
OK<br>
<br>
<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top