Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Date in SQL Insert statement

Geek News

Date in SQL Insert statement
"James Brown" <jamesbrowncoaching[ at ]gmail.com> 11/20/2008 9:23:10 PM
Help!

I have an sql INSERT INTO statement that won't work when I include a date
field. Can anyone advise?

I've removed the date field/value and it works fine.
I've enclosed the Date in # characters.
I have a message box which shows the statement before running it and that
looks fine too.

Thanks in advance.

James



Re: Date in SQL Insert statement
"Allen Browne" <AllenBrowne[ at ]SeeSig.Invalid> 11/20/2008 11:39:47 PM
Is the target field a date/time field?

Make sure you use the US format (regarldless of your regional settings),
e.g. #11/22/2008#.

Post the problem SQL statement if you are still stuck.

Also, tell us how you are executing this, e.g. by running the query, RunSQL
in a macro, or Execute in code.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"James Brown" <jamesbrowncoaching[ at ]gmail.com> wrote in message
news:%23o62yY1SJHA.5364[ at ]TK2MSFTNGP05.phx.gbl...
[Quoted Text]
> Help!
>
> I have an sql INSERT INTO statement that won't work when I include a date
> field. Can anyone advise?
>
> I've removed the date field/value and it works fine.
> I've enclosed the Date in # characters.
> I have a message box which shows the statement before running it and that
> looks fine too.

Re: Date in SQL Insert statement
"Paul Shapiro" <paul[ at ]hideme.broadwayData.com> 11/21/2008 4:02:04 AM
If by any chance the SQL is running against a SQL Server db, the syntax for
a literal date is different. Use single quotes surrounding the date literal
instead of #, and enter the date as 'yyyy.mm.dd'.

"Allen Browne" <AllenBrowne[ at ]SeeSig.Invalid> wrote in message
news:eKHfHl2SJHA.3584[ at ]TK2MSFTNGP06.phx.gbl...
[Quoted Text]
> Is the target field a date/time field?
>
> Make sure you use the US format (regarldless of your regional settings),
> e.g. #11/22/2008#.
>
> Post the problem SQL statement if you are still stuck.
>
> Also, tell us how you are executing this, e.g. by running the query,
> RunSQL in a macro, or Execute in code.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "James Brown" <jamesbrowncoaching[ at ]gmail.com> wrote in message
> news:%23o62yY1SJHA.5364[ at ]TK2MSFTNGP05.phx.gbl...
>> Help!
>>
>> I have an sql INSERT INTO statement that won't work when I include a date
>> field. Can anyone advise?
>>
>> I've removed the date field/value and it works fine.
>> I've enclosed the Date in # characters.
>> I have a message box which shows the statement before running it and that
>> looks fine too.

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net