criteria and dates

  • Thread starter kryszystof via AccessMonster.com
  • Start date
K

kryszystof via AccessMonster.com

Sorry,

i have a query, and i want to create an expression that depends on a date
field.


i have

Field1 | Field2
Date Expr

field 2is such: adj1: iif([DateField] >= "01/01/2002",[do calculation], " ")

i think it has to do with the date format that i am searching by, or possibly
syntax?

TIA,
~K
 
K

kryszystof via AccessMonster.com

wow!, I fixed my problem myself!

thanks to anyone who might have wrote back!

(i removed quotes~ works like charm)
kryszystof said:
Sorry,

i have a query, and i want to create an expression that depends on a date
field.

i have

Field1 | Field2
Date Expr

field 2is such: adj1: iif([DateField] >= "01/01/2002",[do calculation], " ")

i think it has to do with the date format that i am searching by, or possibly
syntax?

TIA,
~K
Hello to all,
 
K

kryszystof via AccessMonster.com

Nevermind, I still need help!

more ways than one! lol
wow!, I fixed my problem myself!

thanks to anyone who might have wrote back!

(i removed quotes~ works like charm)
[quoted text clipped - 15 lines]
 
C

Chaim

Assuming that [DateField] is in fact of type DateTime, then you need to
place the literal date between #...# as in:

IIf (([DateField] >= #01/01/2002#, [do calculation], " ")

Good Luck!
--

Chaim


kryszystof via AccessMonster.com said:
Nevermind, I still need help!

more ways than one! lol
wow!, I fixed my problem myself!

thanks to anyone who might have wrote back!

(i removed quotes~ works like charm)
[quoted text clipped - 15 lines]
Hello to all,
 
M

Marshall Barton

kryszystof said:
i have a query, and i want to create an expression that depends on a date
field.

i have

Field1 | Field2
Date Expr

field 2is such: adj1: iif([DateField] >= "01/01/2002",[do calculation], " ")

i think it has to do with the date format that i am searching by, or possibly
syntax?


Date values (as opposed to text strings) need to be enclosed
in # characters. In addition, you probably do not really
want to evaluate to a space character, or even a zero length
string when the date is before 1/1/02. I can't be sure from
your expression, but I think you want to use:

adj1: IIf([DateField] >= #1/1/2002#, [do calculation], Null)
 
K

kryszystof via AccessMonster.com

THANK YOU EVER SO MUCH!

I have been beating my on my desk all afternoon!

I did (at one time) know about the '#' seperator, but forgot.

Thanks again,
~K

Marshall said:
i have a query, and i want to create an expression that depends on a date
field.
[quoted text clipped - 8 lines]
i think it has to do with the date format that i am searching by, or possibly
syntax?

Date values (as opposed to text strings) need to be enclosed
in # characters. In addition, you probably do not really
want to evaluate to a space character, or even a zero length
string when the date is before 1/1/02. I can't be sure from
your expression, but I think you want to use:

adj1: IIf([DateField] >= #1/1/2002#, [do calculation], Null)
 
V

Van T. Dinh

Just in case you forgot, the explicit date must be in the format
"mm/dd/yyyy" and enclosed in hashes (#) regardless of your regional settings
for dates.

Alternatively, you can use an internationally unambiguous format like
"yyyy-mm-dd" with hashes.

--
HTH
Van T. Dinh
MVP (Access)




kryszystof via AccessMonster.com said:
THANK YOU EVER SO MUCH!

I have been beating my on my desk all afternoon!

I did (at one time) know about the '#' seperator, but forgot.

Thanks again,
~K

Marshall said:
i have a query, and i want to create an expression that depends on a date
field.
[quoted text clipped - 8 lines]
i think it has to do with the date format that i am searching by, or
possibly
syntax?

Date values (as opposed to text strings) need to be enclosed
in # characters. In addition, you probably do not really
want to evaluate to a space character, or even a zero length
string when the date is before 1/1/02. I can't be sure from
your expression, but I think you want to use:

adj1: IIf([DateField] >= #1/1/2002#, [do calculation], Null)
 
Top