A 'simple' date query using iif

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm attempting to create what I thought would be a very simple query which
uses the iif statement.

i.e. IIf([forms]![frm_UserOptions]![chkOpt1,<#01/01/2006#)

I can enter the exactly the same command but without the '<' symbol without
any problem but when I introduce the '<' symbol again I get the problem.

Can anyone suggest what I'm doing wrong please?
 
The > symbol should come before the IIf

<IIf([forms]![frm_UserOptions]![chkOpt1],#01/01/2006#)

But which value do you want to have if the chkOpt1 is not checked
 
My full statement would be/was going to be;

IIf([forms]![frm_UserOptions]![chkOpt1],<#01/01/2006#,>=#01/01/2006)

I thought I woul miss the boring detail out because I thought (bad word) I
would be able to deduce how to do it from the suggestion anyone made.
However, after looking at your solution I'm not so sure.

Could I ask your advice again?

Regards,

Terry

Ofer Cohen said:
The > symbol should come before the IIf

<IIf([forms]![frm_UserOptions]![chkOpt1],#01/01/2006#)

But which value do you want to have if the chkOpt1 is not checked

--
Good Luck
BS"D


TerryM said:
I'm attempting to create what I thought would be a very simple query which
uses the iif statement.

i.e. IIf([forms]![frm_UserOptions]![chkOpt1,<#01/01/2006#)

I can enter the exactly the same command but without the '<' symbol without
any problem but when I introduce the '<' symbol again I get the problem.

Can anyone suggest what I'm doing wrong please?
 
Mybe there is a better solution, but that can work

Between IIf([forms]![frm_UserOptions]![chkOpt1],#01/01/1600#,#01/01/2006)
And IIf([forms]![frm_UserOptions]![chkOpt1],#01/01/2006#,#01/01/2500)

The beggin and End Dates I tried to select dates that you want have grater
or smaller then.

--
Good Luck
BS"D


TerryM said:
My full statement would be/was going to be;

IIf([forms]![frm_UserOptions]![chkOpt1],<#01/01/2006#,>=#01/01/2006)

I thought I woul miss the boring detail out because I thought (bad word) I
would be able to deduce how to do it from the suggestion anyone made.
However, after looking at your solution I'm not so sure.

Could I ask your advice again?

Regards,

Terry

Ofer Cohen said:
The > symbol should come before the IIf

<IIf([forms]![frm_UserOptions]![chkOpt1],#01/01/2006#)

But which value do you want to have if the chkOpt1 is not checked

--
Good Luck
BS"D


TerryM said:
I'm attempting to create what I thought would be a very simple query which
uses the iif statement.

i.e. IIf([forms]![frm_UserOptions]![chkOpt1,<#01/01/2006#)

I can enter the exactly the same command but without the '<' symbol without
any problem but when I introduce the '<' symbol again I get the problem.

Can anyone suggest what I'm doing wrong please?
 
Thank you for both suggestions. I've now updated the query to use your
'between' command and will use it on the remaining queries. However, I'm
sure I will also use your first suggestion on other future queries. Thanks

I was going to say that I would have been on for hours trying to get that
syntax correct but on reflection I already had been on for hours!!

Once again thanks for your help.

Terry


Ofer Cohen said:
Mybe there is a better solution, but that can work

Between IIf([forms]![frm_UserOptions]![chkOpt1],#01/01/1600#,#01/01/2006)
And IIf([forms]![frm_UserOptions]![chkOpt1],#01/01/2006#,#01/01/2500)

The beggin and End Dates I tried to select dates that you want have grater
or smaller then.

--
Good Luck
BS"D


TerryM said:
My full statement would be/was going to be;

IIf([forms]![frm_UserOptions]![chkOpt1],<#01/01/2006#,>=#01/01/2006)

I thought I woul miss the boring detail out because I thought (bad word) I
would be able to deduce how to do it from the suggestion anyone made.
However, after looking at your solution I'm not so sure.

Could I ask your advice again?

Regards,

Terry

Ofer Cohen said:
The > symbol should come before the IIf

<IIf([forms]![frm_UserOptions]![chkOpt1],#01/01/2006#)

But which value do you want to have if the chkOpt1 is not checked

--
Good Luck
BS"D


:

I'm attempting to create what I thought would be a very simple query which
uses the iif statement.

i.e. IIf([forms]![frm_UserOptions]![chkOpt1,<#01/01/2006#)

I can enter the exactly the same command but without the '<' symbol without
any problem but when I introduce the '<' symbol again I get the problem.

Can anyone suggest what I'm doing wrong please?
 
Back
Top