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
|
|||
|
|||
checkbox as query criteria
Hi,
in an Access form i've put a combo box that has a query as data source. On this form I'd like to add a check box that, when it is selected, adds the "is not null" criteria on a query field. There is a simple way to do this? Thank you very much for help. -- Remigio www.sacraspina.it www.amicitosondoro.it www.icmonteodorisio.it www.parrocchiacupello.it www.cralnuovainiziativa.it www.associazionehistonium.it |
#2
|
|||
|
|||
checkbox as query criteria
On Sat, 1 May 2010 05:55:14 -0700 (PDT), remigio
wrote: Create two queries. Then switch between them based on your needs. For example in the myCheckBox_AfterUpdate event you could write: if me.myCheckbox.value = True then Me.myCombobox.RowSource = "query2" else Me.myCombobox.RowSource = "query1" end if (of course you replace myObjectNames with yours) -Tom. Microsoft Access MVP Hi, in an Access form i've put a combo box that has a query as data source. On this form I'd like to add a check box that, when it is selected, adds the "is not null" criteria on a query field. There is a simple way to do this? Thank you very much for help. |
#3
|
|||
|
|||
checkbox as query criteria
On 1 Mag, 15:04, Tom van Stiphout wrote:
On Sat, 1 May 2010 05:55:14 -0700 (PDT), remigio wrote: Create two queries. Then switch between them based on your needs. For example in the myCheckBox_AfterUpdate event you could write: if me.myCheckbox.value = True then * Me.myCombobox.RowSource = "query2" else * Me.myCombobox.RowSource = "query1" end if (of course you replace myObjectNames with yours) -Tom. Microsoft Access MVP Hi, in an Access form i've put a combo box that has a query as data source. On this form I'd like to add a check box that, when it is selected, adds the "is not null" criteria on a query field. There is a simple way to do this? Thank you very much for help. Thank you very much. -- Remigio www.sacraspina.it www.amicitosondoro.it www.icmonteodorisio.it www.parrocchiacupello.it www.cralnuovainiziativa.it www.associazionehistonium.it |
#4
|
|||
|
|||
checkbox as query criteria
Remigio:
You can in fact do it with a single query as the RowSource of the combo box, e.g. SELECT SomeField FROM SomeTable WHERE Form!YourCheckBox = FALSE OR (Form!YourCheckBox = TRUE AND SomeOtherField IS NOT NULL) ORDER BY SomeField; Note the use of the Form property to reference the current form rather than referencing it as a member of the Forms collection. This would return all rows from the table if the check box is not checked, and only those where SomeOtherField contains a value if the check box is checked. Be sure that the check box's default value is False by putting: Me.YourCheckBox = False in the form's Open event procedure. Otherwise it will be Null when the form opens, until checked by the user. In the checkbox's AfterUpdate event procedure requery the combo box: Me.YourComboBox.Requery Ken Sheridan Stafford, England remigio wrote: Hi, in an Access form i've put a combo box that has a query as data source. On this form I'd like to add a check box that, when it is selected, adds the "is not null" criteria on a query field. There is a simple way to do this? Thank you very much for help. -- Remigio www.sacraspina.it www.amicitosondoro.it www.icmonteodorisio.it www.parrocchiacupello.it www.cralnuovainiziativa.it www.associazionehistonium.it -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ccess/201005/1 |
#5
|
|||
|
|||
checkbox as query criteria
On 1 Mag, 18:39, "KenSheridan via AccessMonster.com" u51882@uwe
wrote: Remigio: You can in fact do it with a single query as the RowSource of the combo box, e.g. SELECT SomeField FROM SomeTable WHERE Form!YourCheckBox = FALSE OR (Form!YourCheckBox = TRUE AND SomeOtherField IS NOT NULL) ORDER BY SomeField; Note the use of the Form property to reference the current form rather than referencing it as a member of the Forms collection. This would return all rows from the table if the check box is not checked, and only those where SomeOtherField contains a value if the check box is checked. *Be sure that the check box's default value is False by putting: Me.YourCheckBox = False in the form's Open event procedure. *Otherwise it will be Null when the form opens, until checked by the user. *In the checkbox's AfterUpdate event procedure requery the combo box: Me.YourComboBox.Requery Ken Sheridan Stafford, England remigio wrote: Hi, in an Access form i've put a combo box that has a query as data source. On this form I'd like to add a check box that, when it is selected, adds the "is not null" criteria on a query field. There is a simple way to do this? Thank you very much for help. -- Remigio www.sacraspina.it www.amicitosondoro.it www.icmonteodorisio.it www.parrocchiacupello.it www.cralnuovainiziativa.it www.associazionehistonium.it -- Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/access/201005/1 Thank you so much! |
Thread Tools | |
Display Modes | |
|
|