A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

combobox uses query - filter set by checkbox ?



 
 
Thread Tools Display Modes
  #1  
Old May 20th, 2010, 06:12 PM posted to microsoft.public.access
Pierkes
external usenet poster
 
Posts: 15
Default combobox uses query - filter set by checkbox ?

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


  #2  
Old May 20th, 2010, 06:42 PM posted to microsoft.public.access
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default combobox uses query - filter set by checkbox ?

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" wrote in message
...
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



  #3  
Old May 25th, 2010, 02:09 PM posted to microsoft.public.access
Pierkes
external usenet poster
 
Posts: 15
Default combobox uses query - filter set by checkbox ?

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" wrote in message
...
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" wrote in message
...
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





  #4  
Old May 25th, 2010, 06:23 PM posted to microsoft.public.access
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default combobox uses query - filter set by checkbox ?

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" wrote in message
...
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" wrote in message
...
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" wrote in message
...
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







 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:40 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.