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

Inserting a value into an existing record

Status
Not open for further replies.

MinnKota

Technical User
Nov 19, 2003
166
US
I am trying to insert a value (=now()) into a table. Specifically, I want to insert it into an existing record. I have tried using an update query, but with no success; it always creates a new record.
 
If you know what record, then the update should be:


UPDATE TABLENAME SET SOMETIME = Now() WHERE RECORDNUMBER = 1

What was the query you were using that always inserted a new record?

Leslie
 
Just a note about using Now() vs Date(). Now includes both the Date and the Time where Date() only inludes the date portion in the field.

This is important to know and consider if you are going to someday select records using the Between or <= operators. You see the ending date of a criteria selection will be comparing only the Date portion. Records updated with Now() for the same date as the Ending Date will not be selected. They will include the time also and will be considered greater than a just a date value. (i.e. EndingDate: 6/30/2004 DateField w/Now() value: 6/30/2004 2:40 pm ) The comparison Between BegDate and EndDate where end date is 6/30/2004 will not select this record.

Just something to keep in mind. If you do not need the time of the action then just update the date/time field with Date().

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top