donnie91910
asked on
Adding time to a copied table
I want to add the current time to the end of the table that I am selecting into. Right now I am only adding the date which comes out as: MyTable_20130111. I would like it to have the date on the end as:
MyTable_20130111_10:38:00 PM.
Here is my code that I have now:
Function BkupLastEntry()
With DoCmd
.SetWarnings False
.RunSQL "SELECT * INTO MyTable_" & Format(Now, "yyyymmdd") & " FROM MyTable_EXTRACT"
.SetWarnings True
End With
MyTable_20130111_10:38:00 PM.
Here is my code that I have now:
Function BkupLastEntry()
With DoCmd
.SetWarnings False
.RunSQL "SELECT * INTO MyTable_" & Format(Now, "yyyymmdd") & " FROM MyTable_EXTRACT"
.SetWarnings True
End With
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I when I add the time I get the message:
Run-time error '3067':
Query input must contain at least one table or query.
Run-time error '3067':
Query input must contain at least one table or query.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
On the "End With" statement, I get the following error:
Compile Error:
Expected End Function
Compile Error:
Expected End Function
ASKER
Will this code work with Access 2007?
Function BkupLastEntry()
With DoCmd
.SetWarnings False
.RunSQL "SELECT * INTO MyTable_" & Format(Now, "yyyymmdd_hh_nn_ss_AMPM") & " FROM MyTable_EXTRACT"
.SetWarnings True
End With
Function BkupLastEntry()
With DoCmd
.SetWarnings False
.RunSQL "SELECT * INTO MyTable_" & Format(Now, "yyyymmdd_hh_nn_ss_AMPM") & " FROM MyTable_EXTRACT"
.SetWarnings True
End With
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This works.
ASKER
MyTable_20130111_10:38:00 PM. (or whatever time that it is at the time of the copy).