Question Locked

Conditional RowSource for combo box

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Have a basic sales database in Acess. When entering a sale on a datasheet form I have a combo box that is populated by all products in the products table. I want it to only include items that are not deleted (Yes/No checkbox in table) for new sales but still have deleted products show up when viewing/researching old sales. Can only figure out how to do one or the other, but not both. Any ideas?

4 replies

by tony hopkinson

You need something in your form to say whether you want deleted or not.

Either set by what calls it View Orders or New orders, or last ditch a checkbox called Included deleted orders.

Once you've got that then you can change the query of the datasource have two and swap them, even two versions of the combo pointing at their specific rowsource and make the one you don't want invisible.

Here's something sneaky that might help you along

Select ProductName From Products
Where Product_Deleted = 'No'
Union
Select ProductName From Products
Where Product_Deleted = 'Yes' and !OrderForm.IncludeDeleted = 'Yes'
Order By ProductName.

Forgive me if the syntax is a bit duff, I try to steer clear of Access.

HtHs

by tjcflys

Thanks so much for taking the time to reply. I'm kind of new to this so this helps a lot. I had already made a checkbox so I was on the right track. Working on adapting your solution to my specific case. It is a datasheet format so I'm working on using the columnhidden property.
Thanks for sending me in the right direction!

by tony hopkinson

He says with an opposable digit pointing vertically as a subtle hint.

This discussion is closed to new replies.