Dropdown box with parameter in source

G

Guest

I have a dropdown box that I would like its values to change depending on a
new value that I get in a field on the OnCurrent Event.
For example, if I was to go to a new record with a new employee number, I
would like the dropdown box to show that employee's dependent (I would like
the dropdown source to reselect that employee's dependents from another table
based on the current employee number on the form.
Thanks,
 
R

Rick Brandt

Stanley said:
I have a dropdown box that I would like its values to change
depending on a new value that I get in a field on the OnCurrent Event.
For example, if I was to go to a new record with a new employee
number, I would like the dropdown box to show that employee's
dependent (I would like the dropdown source to reselect that
employee's dependents from another table based on the current
employee number on the form.
Thanks,

The query used for the RowSource of the ComboBox needs to reference a
field/control on the form for its criteria.

SELECT dependent
FROM dependents
WHERE [employee number] = Forms!NameOfForm![employee number]

In the Current event of the form you need to issue a Requery on the ComboBox...

Me!ComboBoxName.Requery
 

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