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

Using combo box in form to populate other text boxes 1

Status
Not open for further replies.

CJP12711

MIS
Jul 23, 2001
116
US
I have a form with a combo box and 3 text fields. The combo box is pulling the list of facilities from table 'hospitals'. This table includes the below fields:

Hospital
Community
Teaching
Normal

When the hospital is chosen from the drop down box, I want the other 3 text fields to be automatically populated with the other 3 fields from the table. I do not want users to be able to update the data in the table from the form. I am using Access 2003. Any help is appreciated! Thanks!
CJ
 
In the AfterUpdate event procedure or your combo:
Me![Community textbox]= Me![your combo].Column(1)
Me![Teaching textbox]= Me![your combo].Column(2)
Me![Normal textbox]= Me![your combo].Column(3)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Your textboxes can be unbounded. Then you can use the Dlookup function on the AfterUpdate event of the combobox to populate them. You can find Dlookup in the Access Help or a book. Also, if you search the Access forums, this has been answered numerous times.
 
PHV and I have different opinions of what your combobox looks like.
 
My combo box just has 4 facilities listed in it. It is unbound.
 
Also, I had searched the forum for the answer, but was still having trouble getting the syntax right to work with my data. Thanks for your help!
 
Explaining to us what you did might help us help you. Did you see:
Dlookup problems
thread702-1439989

faq702-4398 How to use Combo box as a Navigation tool
 
I didn't see that one, and that did the trick! It's working! Thanks so much for your help!

CJ
 
I don't understand why your combo don't have the 3 other fields too.
Why using 3 unnecessary DLookUp calls ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top