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

more combo box problems

Status
Not open for further replies.

aejester

Programmer
Aug 29, 2001
52
CA
Hi,

I have a maintenance form displayed as a continuous form(mutiple records display at once). In each record there are 2 combo boxes, one for the equipment type, and one for the inventory item. When the user selects an equipment type, the inventory combo box should display only those items that are of that equipment type.

I have coded my program so that the inventory combo box selects the correct data when you change the equipment type, but the problem is EVERY record's inventory combo box changes as well.

Is there a way to modify only the record that has the focus????? Or is there another way to do this that could avoid this problem altogether?

Thanx in advance!
 
The multiple rows on a continuous form are really displaying copies of the same combo box (or list box, etc.) control. There is only one control, so no, you can't change the list for just one row.

But your question was whether there is a way to modify only the record that has the focus. Changing the list in the combo box, by itself, shouldn't update any records, so I'm not entirely sure what the problem is. When you enter the equipment type, are you seeing changes occur in other rows? Or is it only that, when you enter the equipment type and then click down the list in another row, it has the wrong inventory list?

If that last is what you're seeing, the problem is that you're not keeping the list in sync with the current row. You should be able to fix that by using the form's Current event to reload the inventory combo's list every time you change records. Yes, the list will change for every row when you do, but you'll never see that, since the only way to inspect the list on another row is to click in that row, which will update the list to be correct again.

The code you use in the Form_Current event procedure should check the equipment type. If it's null, you should make the inventory combo's list empty. Otherwise, you should change the RowSource property (if you're using a Value List) and call the inventory combo's Requery method. This is the same as, or close to, what I assume you're already doing in the equipment type combo's AfterUpdate event. Rick Sprague
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top