• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 91
  • 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
 
pdvsaProject financeAuthor 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
 
pdvsaProject financeAuthor Commented:
Oh I see that the points are split. I did not know that.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

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