i have a form that contains ID(combobox), name(textbox),age(textbox)
these three fields is create under db1.mdb.
once the user select the ID from the combo box(select 3000), when the user release the mouse, the textbox of name will automatically appear
"John", how to do this? any code is appreciate.
p/s: this form is run under visaul basic
First, a word of advice: if possible, avoid using "name" as a field name in Access. Since it is a property of most objects in the database, it can cause conficts when setting up reports and in VBA code.
Having said that, what you need can be accomplished using the AfterUpdate event of your combobox. In the design view of the form, select the combo box and open up the properties box. Go to the Events tab and look for the AfterUpdate event. In the box for the AfterUpdate event, type a left square bracket ( "[" - next to the P key) and words "Event Procedure" will appear. Click the ellipsis (...) to the right of the box to open up the VBA editor. A procedure for the AfterUpdate event will be started for you.
In order to automatically update the textbox for name, use the following code (substitute your actual form control names):