G
Gus
HI,
I'm trying to perform a query based on 1 to 3 variables in
a form. These are Date, RMR and Postcode. The unbound text
boxes in each of these fields are txtDate1, txtDate2,
txtRMR1, txtRMR2, txtPostCode1 and txtPostCode2. I wish
for a user to be able to perform a search using and one or
combination of the entered values.
On the form next to each of these is an unbound check box
named accordingly eg chktxtDate.
In a query which looks at these I have written the
following code in the criteria:
IIf([Forms]![frmResignMenu]![chkdate]=-1,
([tblContractExpiration].[Expires]) Between [Forms]!
[frmResignMenu]![txtdate1] And [Forms]![frmResignMenu]!
[txtdate2],([tblContractExpiration].[Expires]) Between
#01/01/1900# And #01/01/2090#)
I have also tried:
IIf([Forms]![frmResignMenu]![chkdate]=-1,Between [Forms]!
[frmResignMenu]![txtdate1] And [Forms]![frmResignMenu]!
[txtdate2],Between #01/01/1900# And #01/01/2090#)
Each of the two criterias individualy work fine but when I
set the IIF statement into the equation no data come up.
I have tried using variuos other terms for the "on/off"
parts of the check box but these do not appear to work and
have no idea what is wrong with the logic.
Could you tell me how to make this code work or what is
another option to pursue if this is not possible.
Thanks in advance.
I'm trying to perform a query based on 1 to 3 variables in
a form. These are Date, RMR and Postcode. The unbound text
boxes in each of these fields are txtDate1, txtDate2,
txtRMR1, txtRMR2, txtPostCode1 and txtPostCode2. I wish
for a user to be able to perform a search using and one or
combination of the entered values.
On the form next to each of these is an unbound check box
named accordingly eg chktxtDate.
In a query which looks at these I have written the
following code in the criteria:
IIf([Forms]![frmResignMenu]![chkdate]=-1,
([tblContractExpiration].[Expires]) Between [Forms]!
[frmResignMenu]![txtdate1] And [Forms]![frmResignMenu]!
[txtdate2],([tblContractExpiration].[Expires]) Between
#01/01/1900# And #01/01/2090#)
I have also tried:
IIf([Forms]![frmResignMenu]![chkdate]=-1,Between [Forms]!
[frmResignMenu]![txtdate1] And [Forms]![frmResignMenu]!
[txtdate2],Between #01/01/1900# And #01/01/2090#)
Each of the two criterias individualy work fine but when I
set the IIF statement into the equation no data come up.
I have tried using variuos other terms for the "on/off"
parts of the check box but these do not appear to work and
have no idea what is wrong with the logic.
Could you tell me how to make this code work or what is
another option to pursue if this is not possible.
Thanks in advance.