Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Inserting value into Date/Time Field

Status
Not open for further replies.

Robeen

Programmer
Mar 25, 2003
38
US
I need help writing a query that will insert a date into a Date/Time field in MS Accesss.
I have tried:
1.
INSERT INTO receipts (Folio, Amount,Code,DatePaid)
VALUES ('44444',555.55,'TUI4',#03/27/03#)
2.
INSERT INTO receipts (Folio, Amount,Code,DatePaid)
VALUES ('44444',555.55,'TUI4','03/27/03')
3.
INSERT INTO receipts (Folio, Amount,Code,DatePaid)
VALUES ('44444',555.55,'TUI4',#03-27-03#)
4.
INSERT INTO receipts (Folio, Amount,Code,DatePaid)
VALUES ('44444',555.55,'TUI4',#03-Mar-03#)
. . . and a few other variatons that I don't remember
I would appreciate any help.
I am using the queries in a very simple VB 6.0 [using an Execute SQL statement that executes SQL that I type into a text box] application.
I can insert strings, integers, currency values . . . but not the date. I want to be able to insert a user-entered date and also the current date/time as a kind of timestamp.
I have to be able to insert a date/time value as the date/time field is part of the key in the table.
I'm used to doing this kind of thing in SQL Server Stored procs with date variables . . .
Thanks!
Robin
 
There is a bug in both 97 and 2k versions. In order to be sure that what Access understands is what you really mean the surest thing to do is passing it the date like "#27/mar/2003#". As I looked around this is the only way you don't risk to mess it up.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top