Link to home
Start Free TrialLog in
Avatar of Phoat
Phoat

asked on

Requery combobox in datasheet view

I have a subform datasheet, with the following columns...

Category  Product  Price

Category and Product columns are both comboboxes.  The rowsource for Products depends on the selection in the catagory combobox, however when i requery the product combobox, it requeries for all records on the datasheet, not for the current record, causing data to 'disappear' from other records.

Is there a way to prevent this from happening?  I tried making the form in continious form view with the same results.  Please help!

Thanks,
Phoat
ASKER CERTIFIED SOLUTION
Avatar of BrianWren
BrianWren

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Phoat
Phoat

ASKER

i did that also... but lets say i choose vegetables from the categories column.  The cboPrd column's rowsource will change and i'll be able to pick lets say tomatoes....

but when i goto the next record, and i choose fruit for the categories column, the products column updates its rowsource and the previous record's value disappears.  It changes the rowsource for ALL the records, not just the current one... Im in datasheet view, don't forget.

Phoat
Avatar of Phoat

ASKER

Ok i got it to work i think....

I'll let you know once i test it a bit

Phoat
Using controls that will change, in datasheet or continuous form views is problematic.

When you change the RowSource, you change the definition of that type of control, for that form.  So they all change.  

I suspect that the underlying data in the table stays the same though...

I would really recommend swtching to single form view, and using the OnCurrent event as well to coordinate these two combos as you move from record to record...

Brian

Avatar of Phoat

ASKER

i got it work.... Thanks!

The problem was that i was requery-ing the cbo after changing the rowsource, so it would update the display and erase the entries that didn't meet the criteria in the underlying SQL.  It worked after i took out the requery method from the cbo.

Thanks again.

Phoat...