combobox uses query - filter set by checkbox ?

  • Thread starter Thread starter Pierkes
  • Start date Start date
P

Pierkes

Hi,

On a form i have
- a combobox called "combo_house" based on a query called " Houses".

In the query i have a column called "price" and a column called "transdate"
which is a date.

On the form i also have 2 toggle boxes;
one called "sold"
one called "not sold"

I would like to be able to filter the query used by the combobox when the
togglebox is checked. So when i check "sold" the query used by the combobox
should be filtered on the value in column "price" > 0 OR column "transdate"

Can anyone help me on the vba code to do this please ?
Thanks very much,
Pierre
 
Pierre

Consider using an option group rather than a pair of toggle boxes. That
way, only one of the conditions would be "true".

Then, in the option group's AfterUpdate event, you could set/re-set the
RowSource property of the combobox to the appropriate query (use two
queries, one for each condition).

I'm not familiar with the particulars of your business (you haven't
described them), but it seems to me that the sales date might not be in the
future (i.e., > Date() -- "greater than today's date").

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
Hi,

Now i used 2 queries and it works perfectly !
Thanks for helping me !

However, i feel it should be possible to just change the filter on a query
that is used by the combobox instead of using two queries ?

Best regards,
Pierre
 
Perhaps one of the other newsgroup readers has done something like this. I
don't have any experience using this approach.

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
Back
Top