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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|