populate default value when using append query (1 Viewer)

kobiashi

Registered User.
Local time
Today, 06:19
Joined
May 11, 2018
Messages
258
im using the append query to insert data into a table from another table, when the data is inserted into the new table, how can i populate the default value in a field in the new table?, ie when the record is inserted into the new table, i want to be able to capture the date and time of when this occurred.
 

isladogs

MVP / VIP
Local time
Today, 06:19
Joined
Jan 14, 2017
Messages
18,186
If a field has a default value, omit it from the append query and I believe it should be populated automatically when the new record is added.

Alternatively, remove the default value from the field and just include it in your append query for that field.
 

kobiashi

Registered User.
Local time
Today, 06:19
Joined
May 11, 2018
Messages
258
If a field has a default value, omit it from the append query and I believe it should be populated automatically when the new record is added.

Alternatively, remove the default value from the field and just include it in your append query for that field.

thanks for the reply,

i had orignally tried to set the default value, and apply the relevant fields in the append query, but it doesnt auto populate

when you say include the values in the query, do you mean assign "Date()" to the relevant field criteria in the query?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:19
Joined
Feb 19, 2002
Messages
42,981
The default value is defined on the column of the table. So if you want DateAdded to default to the current date, set it's default to Date(). Then in your append query, either omit the "DateAdded" field entirely or use a Null when there is no valid value for the field.

If I were running an append query, I would normally omit the fields for which I want defaults to be applied just to avoid confusion.

Note that defaults only apply for append queries. Update queries will not substitute the default for nulls.
 

Users who are viewing this thread

Top Bottom