Date & time

  • Thread starter Thread starter Barcode
  • Start date Start date
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
 
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().
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top