• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 82
  • Last Modified:

Append - add current date

Hello,

I am appending records to an archive and want to assign the current date to a [Date_Archive] in the archive table.

Here is the append:
Insert Into Import_FC_Archive
Select Import_FC.*
From Import_FC

I am executing this saved append query like so:
Private Sub cmdImport_Click()
  Docmd.OpenQuery "qryAppend_importFC"

(I have a docmd transferspreadsheet after this) -  typing from phone

Thank you
0
pdvsa
Asked:
pdvsa
  • 2
  • 2
2 Solutions
 
Rgonzo1971Commented:
Hi,

pls try
INSERT INTO Import_FC_Archive 
SELECT  *, Date() AS Date_Archive
FROM Import_FC;

Open in new window

Regards
0
 
Ryan ChongCommented:
I am appending records to an archive and want to assign the current date to a [Date_Archive] in the archive table.
it's unnecessarily to do it via coding.

go to the field's property. and set its default value to =Now()
SnapShot.png
0
 
Ryan ChongCommented:
and set it to =Date() if you want to insert date only.
0
 
pdvsaAuthor Commented:
I awarded points to Rgonzo because it is the answer to my question and I was not aware I could set the default value Ryan mentioned.  Even though Ryan's answer is a better one for me and it is the one I will use, I want to be fair as my quesiton only mentioned how to edit the VBA.  I always appreciate a more efficient way to performing a task.  Thank you  

any objections please let me know.
0
 
pdvsaAuthor Commented:
Oh I see that the points are split. I did not know that.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now