Date & time

B

Barcode

Hello

I would like to insert the Date and Time, but when I test this code it
insert only date.
How it is possible to insert in the same filed date + time ?

DoCmd.RunSQL "INSERT INTO Tillgangar ( Anvand, now, Mobiltelefon ) SELECT 1,
Date() , [Mobiltelefon];"


Thank you
 
J

John W. Vinson

Hello

I would like to insert the Date and Time, but when I test this code it
insert only date.
How it is possible to insert in the same filed date + time ?

DoCmd.RunSQL "INSERT INTO Tillgangar ( Anvand, now, Mobiltelefon ) SELECT 1,
Date() , [Mobiltelefon];"


Thank you

Date() inserts the current date. Now() inserts the date and time. Just replace
the Date() in the insert clause with Now().
 
D

Douglas J. Steele

In addition to the advice John gave you, I'd strongly recommend that you
rename the field in your table named Now. Now is a reserved word, and using
it for your own purposes can lead to all sorts of problems.

For a good discussion on what names to avoid, see what Allen Browne has at
http://www.allenbrowne.com/AppIssueBadWord.html
 
Top