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!

conditioning the appearance of a drop down list in an adjacent field

Status
Not open for further replies.

uscitizen

Technical User
Jan 17, 2003
672
US
in the interest of time, let's say there are just three fields on a table. one has three values which are found in a drop-down combo box: "Abnormal", "Normal" and "Unknown". in the adjacent field, we have a drop-down list from a combo-box as well. the choices are too many to describe here, but for the sake of this question, what's important to remember is that when the first field is scored "Abnormal", the person performing the data entry must pick from among the choices given in the adjacent field. so, here's my question: is it possible to cause the second field to display the choices available to the data entry clerk as soon as the "Abnormal" choice in the first field is entered? if the other choices are not taken, i.e. "Normal" or "Unknown" then perhaps we might the cursor to travel to the third field.
 
Two comboboxes where after the first combobox has a selection made the contents of the second combobox is requeried with the codes of data that correspond to the first combobox's selection. Is that what you are asking?

If so, Yes this can be done. The RowSource of the second combobox has either SQL statement or a query name. Whichever you choose the criteria for the code would be a reference to first combobox's value.
Example:
SELECT tblYourTableName.TargetField
FROM tblYourTableName
WHERE (((tblYourTableName.TargetField)=[Forms]![frmYourForm]![Combo1]));

Once that is done you must have in the AfterUpdate of the first combobox's event procedure the following:
me.combobox2.setfocus
me.combobox2.requery
me.comobbox2.dropdown

This will cause the cursor to move to the second combobox, requery the contents based on the combobox1's selection, and force the combobox to dropdown its list of choices.
Bob Scriver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top