Link to home
Start Free TrialLog in
Avatar of GPSPOW
GPSPOWFlag for United States of America

asked on

CAST equivalent in MS Access

What is the MS-Access equivalent to the SQL statement:

DATEADD(SECOND, CAST([FieldName],'1980-03-01')  between [AdmitDate] and [DischargeDate]


Thanks

glen
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

try using the Format () function

Format([FieldName],'yyyy-mm-dd')
Avatar of GPSPOW

ASKER

Sorry did not work.

Here is the SQL statement from the original SQL Stored Procedure:

DATEADD(SECOND,CAST(RXA.MedRecSecondsID AS NUMERIC), '1980-03-01')
       BETWEEN TP.AdmSerDateTime and TP.DischargeDateTime

The field RXA.MedRecSecondsID is NUMERIC in its source table.

example of data:    1056296349

I assume the data field holds the # of seconds since 1/1/1900.

The converted MedRecSecondsID falls between the two dates.

thanks

Glen
try using

Clng(RXA.MedRecSecondsID)
Avatar of GPSPOW

ASKER

Would the statement be?


DATEADD("s",Clng(RXA.MedRecSecondsID), '1980-03-01')
       BETWEEN TP.AdmSerDateTime and TP.DischargeDateTime
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of GPSPOW

ASKER

Thank you

It worked!