From: Pierkes on
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"
> date()

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


From: Jeff Boyce on
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.

"Pierkes" <info(a)advisearch.nl> wrote in message
news:4bf56d71$0$18738$703f8584(a)news.kpn.nl...
> 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"
> > date()
>
> Can anyone help me on the vba code to do this please ?
> Thanks very much,
> Pierre
>


From: Pierkes on
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

"Jeff Boyce" <nonsense(a)nonsense.com> wrote in message
news:%23eu6dPE%23KHA.4816(a)TK2MSFTNGP02.phx.gbl...
> 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.
>
> "Pierkes" <info(a)advisearch.nl> wrote in message
> news:4bf56d71$0$18738$703f8584(a)news.kpn.nl...
>> 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"
>> > date()
>>
>> Can anyone help me on the vba code to do this please ?
>> Thanks very much,
>> Pierre
>>
>
>


From: Jeff Boyce on
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.

"Pierkes" <info(a)advisearch.nl> wrote in message
news:4bfbcbf8$0$9887$703f8584(a)news.kpn.nl...
> 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
>
> "Jeff Boyce" <nonsense(a)nonsense.com> wrote in message
> news:%23eu6dPE%23KHA.4816(a)TK2MSFTNGP02.phx.gbl...
>> 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.
>>
>> "Pierkes" <info(a)advisearch.nl> wrote in message
>> news:4bf56d71$0$18738$703f8584(a)news.kpn.nl...
>>> 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"
>>> > date()
>>>
>>> Can anyone help me on the vba code to do this please ?
>>> Thanks very much,
>>> Pierre
>>>
>>
>>
>
>