How to get one field to update based on a selection from a drop do

R

RMorton

New to Access. I want to create a form that coworkers can use to lookup
information in a database for inputting data into a PO as well as submit new
records into the database. I want to have a control that is a combo drop down
box where the can select a row from a list of items in a specified field and
based on that selection it will update the below text box control with the
corresponding data in the field next to it on the database. Make sense?
Basically need to figure out how to update one control based on data selected
from the drop down box control above it???
 
L

Linq Adams via AccessMonster.com

Private Sub YourComboBox_AfterUpdate()
Me.TextBoxName = Me.YourComboBox.Column(X)
End Sub

where the X is an integer designating the column of the combobox you want to
populate the Textbox. This is Zero-based, so reading the combobox Left-to-
Right, if you have, say, fields

PO_Num, Company, ContactName

and you wanted the textbox to be populated with the PO_Num, you'd use

Me.TextBoxName = Me.YourComboBox.Column(0)

For the Company name

Me.TextBoxName = Me.YourComboBox.Column(1)

And likewise, for the ContactName

Me.TextBoxName = Me.YourComboBox.Column(2)
 
G

golfinray

The standard search form is to use a combo. Allow the combo wizard to do that
for you and select the field you want to search on. Then right click on the
combo to get properties, go to events, and then select the afterupdate event.
Type:
Me.filter = "[yourfieldyouaresearchingon] = """ % Me.combo# & """"
me.filteron = true
The combo# will be listed, like combo22 or combo10.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top