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!

Pasting a record and populating a field

Status
Not open for further replies.

MinnKota

Technical User
Nov 19, 2003
166
US
I am copying a record from one table to another (similar) table, using "DoCmd.RunCommand acCmdPasteAppend."

I have a [Time pasted] field in the receiving table which has a default value of "=now()" but when I past the record in the code, the date field doesn't fill...can I do this with SQL or code?
 
DoCmd.RunSQL "INSERT INTO newTable(field1,field2,...) SELECT col1,col2,... FROM oldTable WHERE ..."

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I am not sure I understand how to make this statement work. I don't see the now() function in the query. Do I use this query INSTEAD of the "acCmdPasteAppend" command?
 
Yes, instead.
If you want default value override the data you wanted to paste, consider something like this:
DoCmd.RunSQL "INSERT INTO newTable(field1,field2,DateTimeField,...) SELECT col1,col2,Now(),... FROM oldTable WHERE ..."

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top