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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import date and time 1

Status
Not open for further replies.

ptrifile

Technical User
Joined
Aug 10, 2004
Messages
457
Location
US
I have an excel spreadsheet that I import into a table every 4 hours, what i would like to do is have the time and date that the file is imported...is there a way to write this to a table so i can run reports on how many new orders were imported into my system between certain times?

Thank you for any help!

Paul
 
You could use a query, for example:


Code:
INSERT INTO tblT ( [Id], [Blah], [ImportDate] )
SELECT Id, Blah, Now As ImportDate
FROM [Sheet1$] IN '' [Excel 8.0;database=C:\Docs\LTD.xls];


 
Thanks Remou, if I'm reading this correctly this would pull the import date from a field or row or cell from excel, right?

If so, is there a way to do it if the import date is not in the spreadsheet? so just have it automatically give the exact time and date it was imported into access?

Thanks again!

Paul
 
You will notice the SQL includes:

Now As ImportDate

This should put the current date and time into a field.
 
Now() is an MS Access built-in function, it returns the date and time.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
Remou, Thank you! I missed the NOW in the code. Thank you for your help, that worked perfectly!

Paul
 
set the default value of importdate field in the table to now()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top