IIF Function

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

Guest

hi,
i'm currently using the IIF statement to extract the dates out as shown
below:
"
IIf([dbo_currency].[curr_code]='sgd',#1/1/2001#,[Forms]![Year_Month_M]![cur-month] & "/" & [Forms]![Year_Month_M]![cur-year]) "

before extracting the dates out from the SQL server, the date was in this
format: "8/1/2003 9:00:00 AM".

to get the dates only, i used "date: Left([eff_date],9)" code to return me
the date value. however when i go on to match the form's date to the iif
function, the value that got out was only one date and the date that was
being called out does not match the date that i've selected on the form.

fyi: the date that got out was "1/1/2001"

please help! and thanks alot!
 
Why aren't you using standard Access Date functions to extract the dates?
Using string functions can get you in trouble since the dates can vary in
length...
 
i used "date: Left([eff_date],9)" code to return me
the date value

If you have to use strings-as-dates, then you really have to format them in
ISO standard yyyy-mm-dd otherwise you won't have any chance of sorting or
comparing them.

B Wishes


Tim F
 
Back
Top