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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem date and INSERT INTO 1

Status
Not open for further replies.

jpl458

Technical User
Sep 30, 2009
337
US
Have the following code where I need to insert data plus the Date and Time it's inserted

Dim SentSql as String
SentSql = "INSERT INTO SentEmailTbl(Account_Number, Event, DateSent) Values('" & GBL_Master_Id & "', '" & GBL_Event & "', NOW())" (This example is right from the web)

In the immediate window it looks like this
INSERT INTO SentEmailTbl(Account_Number, Event, DateSent) Values('655812', '$5 E_Coupon', NOW())

Ive tried dozens of variations includint the TIMESTAMP feature in tables, but you can't delete those records and I need to do that. All kinds of tries with # on either side. The list goes on.

Thanks

jpl
 
hi,

Try this
Code:
SentSql = "INSERT INTO SentEmailTbl(Account_Number, Event, DateSent) Values('" & GBL_Master_Id & "', '" & GBL_Event & "'," &  NOW() & ")"

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
I would try
Code:
SentSql = "INSERT INTO SentEmailTbl(Account_Number, Event, DateSent) Values('" & GBL_Master_Id & "', '" & GBL_Event & "',#" & Format(now(),"yyyy-mm-dd hh:nn:ss") & "#)"

Duane
Hook'D on Access
MS Access MVP
 
Duane's solution worked, but Skips did not-Tried both.

Thanks for the quick response

jpl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top