Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Trouble with UPDATE statement and Date


Message #1 by "James Duncan" <vbcode@j...> on Sun, 8 Jul 2001 23:10:38
Hi there,



I'm trying to modify a DATE field in Access with the following SQL 

statement:



UPDATE Companies SET Date = #02/03/2001# WHERE ID = 89



It doesn't work. Nor does anything else that I've tried. How do u update 

a "DATE" field in Access with the SQL UPDATE command?



Many thanks



James

Message #2 by "John Ruff" <papparuff@c...> on Mon, 9 Jul 2001 03:47:04 -0700
Date is a reserved word in VBA so the SQL statement does not know what you

mean.  Place brackets around Date.  Change your statement to read:



UPDATE Company SET [Date] = #02/03/2001# WHERE ID=89



John Ruff - The Eternal Optimist :)

 -----Original Message-----

From: 	James Duncan [mailto:vbcode@j...]

Sent:	Sunday, July 08, 2001 11:11 PM

To:	Access

Subject:	[access] Trouble with UPDATE statement and Date



Hi there,



I'm trying to modify a DATE field in Access with the following SQL

statement:



UPDATE Companies SET Date = #02/03/2001# WHERE ID = 89



It doesn't work. Nor does anything else that I've tried. How do u update

a "DATE" field in Access with the SQL UPDATE command?



Many thanks



James

Message #3 by "James Duncan" <vbcode@j...> on Mon, 9 Jul 2001 12:57:59
> Date is a reserved word in VBA so the SQL statement does not know what 

you

> mean.  Place brackets around Date.  Change your statement to read:

> 

> UPDATE Company SET [Date] = #02/03/2001# WHERE ID=89

> 

> John Ruff - The Eternal Optimist :)

>  -----Original Message-----

> From: 	James Duncan [mailto:vbcode@j...]

> Sent:	Sunday, July 08, 2001 11:11 PM

> To:	Access

> Subject:	[access] Trouble with UPDATE statement and Date

> 

> Hi there,

> 

> I'm trying to modify a DATE field in Access with the following SQL

> statement:

> 

> UPDATE Companies SET Date = #02/03/2001# WHERE ID = 89

> 

> It doesn't work. Nor does anything else that I've tried. How do u update

> a "DATE" field in Access with the SQL UPDATE command?

> 

> Many thanks

> 

> James



Thanks for the advice. I finally worked out that the field name was the 

problem when i renamed it and all worked. I didn't know u could use [ ] to 

enclose the field name. I have now changed my field name back to Date and 

enclosed it with the square backets in my SQL statement and all works.



Many thanks.

Message #4 by Walt Morgan <wmorgan@s...> on Mon, 09 Jul 2001 07:01:53 -0500
If your field name is actually "Date", there may be a problem with the

"reserved word" -Date-.



Hope this helps.



Walt



Message #5 by "Diogo" <dikaran@i...> on Tue, 10 Jul 2001 22:28:25 -0300
Date is a reserved word for sql, though try to change this column name.

----- Original Message -----

From: "James Duncan" <vbcode@j...>

To: "Access" <access@p...>

Sent: Sunday, July 08, 2001 11:10 PM

Subject: [access] Trouble with UPDATE statement and Date





> Hi there,

>

> I'm trying to modify a DATE field in Access with the following SQL

> statement:

>

> UPDATE Companies SET Date = #02/03/2001# WHERE ID = 89

>

> It doesn't work. Nor does anything else that I've tried. How do u update

> a "DATE" field in Access with the SQL UPDATE command?

>

> Many thanks

>

> James

>

>






  Return to Index