Question

Locked

Conditional RowSource for combo box

By tjcflys ·
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?

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Cheat

by Tony Hopkinson In reply to Conditional RowSource for ...

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

Collapse -

Thank you - - -

by tjcflys In reply to Cheat

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!

Collapse -

No problem

by Tony Hopkinson In reply to Thank you - - -

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

Back to Software Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums