Import File with FSO Date and Time

Posted on 2003-03-21
Medium Priority
Last Modified: 2012-06-27
I am currently writing a macro to import a file.  I want to append the file date/time with each record.  This way, I can prequery the data table and stop the file from being imported more than once.

Question by:sluggo050499
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
LVL 58
ID: 8181513
Just open the table that your appending to in design mode and on your date/time field, set the default to Date() or Now() (if you need the time).

LVL 58
ID: 8181517
Or are your creating a brand new table?


Author Comment

ID: 8182883
I will be appending the data to an existing table.  The field for the date & time on the file will be in a field called 'filedate'.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

LVL 58
ID: 8184302
Then just set the default value for FileDate to Now() or Date().  It will be filled in automatically as soon as the record is appended.


Author Comment

ID: 8184339
FSO=File System Object.  Part of the FSO is the creation date and time.  That's what I need to import.  Not the Now() or Date().

LVL 58

Accepted Solution

Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 8184701
<<FSO=File System Object.  Part of the FSO is the creation date and time.  That's what I need to import.  Not the Now() or Date().>>

 Duh...now I know what you meant and why it didn't make sense at the time<g>.

 He's an example:

Function ShowFileInfo(filespec)
   Dim fso, f
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFile(filespec)
   ShowFileInfo = "Created: " & f.DateCreated
End Function


Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question