Re: Receiving 3077 Date syntax error from international users

From: Douglas J. Steele (NOSPAM_djsteele_at_NOSPAM_canada.com)
Date: 01/12/05


Date: Wed, 12 Jan 2005 18:41:25 -0500

Alternatively, you should be able to use

"WhichDay < CDate('" & DateAdd("d", -2, Date) & "')"

Note the single quotes in there: exagerated for clarity, it's

"WhichDay < CDate( ' " & DateAdd("d", -2, Date) & " ' )"

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Jezebel" <mad***@whitehouse.gov> wrote in message 
news:%23pswQEF%23EHA.3708@TK2MSFTNGP14.phx.gbl...
> The problem is that you're not formatting the date. So the code will work 
> on
> machines where the regional setting provides a date format that DAO will
> accept, and not otherwise. You should always explicitly format dates for
> inclusion in SQL strings ...
>
> Const gISO_DateFormat as string = "yyyy-mm-dd"
>
> "WhichDay < #" & format$(DateAdd("d", -2, Date), gISO_DateFormat) & "#"
>
>
>
>
>
> "Noah Spitzer-Williams" <NoahSpitzerWilliams@discussions.microsoft.com>
> wrote in message 
> news:D70D1569-CCB9-43C7-BBF7-D2331CC28845@microsoft.com...
>> Hello,
>>
>>    My software application uses some DAO fields with the type dbDate.
>> However many of my international users have been getting the following
> error:
>> 3077 Syntax error in date in expression. Is there any way I can fix this?
>>
>>    An example script:
>>     MyRS.FindFirst "WhichDay < #" & DateAdd("d", -2, Date) & "#"
>>
>> Thanks!
>>
>>    - Noah
>
>