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!

Using combobox data as part of a field

Status
Not open for further replies.

jgarnick

Programmer
Feb 16, 2000
189
US
I have a combo box that has three choices Business, Home, Other. I have address fields named businessstreet, businesscity, homestreet, homecity etc in the same table.<br><br>I want to be able to have textboxes display the appropriate address information based on what the user chooses from the combo box on the same form.&nbsp;&nbsp;I have tried many variations of the statement below but I can't get the syntax right.&nbsp;&nbsp;<br><br>=[forms]![formname]![combobox]&&quot;city&quot;<br><br>I'm not even sure it can be done.&nbsp;&nbsp;Any help would be appreciated!<br> <p>jgarnick<br><a href=mailto:jgarnick@aol.com>jgarnick@aol.com</a><br><a href= > </a><br>
 
j,<br>I'm assuming these textboxes are unbound and so is the combobox?&nbsp;&nbsp;You'd use the AfterUpdate of the combobox, and do something like:<br><br>Select Case Me!combobox<br>case is &quot;Business&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Me!txtstreet = me!businessstreet&nbsp;&nbsp;&nbsp;'load unbound box with street type data<br>'etc<br>Case is &quot;Home&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Me!txtStreet = me!homestreet<br>'etc<br>Case is &quot;other&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Me!txtStreet = me!homestreet<br>'etc<br>End select<br><br>--Jim
 
Sorry about the syntax above--Use Case is = &quot;Business&quot;, etc--I'd forgotten the '='.<br>--Jim
 
Might also consider the dlookup function
 
Thanks for your help Jim, it worked wonders!&nbsp;&nbsp;I ended up putting the code in the oncurrent property of the form so that the form opens with correct data.<br><br>Thanks again--<br>J <p>jgarnick<br><a href=mailto:jgarnick@aol.com>jgarnick@aol.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top