Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 14th, 2005, 01:49 AM
Authorized User
 
Join Date: Jul 2005
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Capturing date from transferred file

Backround:
I use Access to transfer file attachments from Outlook to a certain folder on a server for further processing. That works fine, but I would like to return the "Modified" date of the transferred files to my Access form by the file name list. How can I capture the file dates from the folder?

Thanx in advance.

Reply With Quote
  #2 (permalink)  
Old July 15th, 2005, 07:27 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Hi,

   This will get you your file DateCreated:

'----------
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("C:\data.csv")
stLongDate = objFile.DateCreated
DateArray = Split(stLongDate, " ")
stShortDate = DateArray(0)
WScript.Echo stShortDate
'----------

   objFile.DateCreated is the date and time the file was created. I split it using the space between the date and time to get just the date. I used a file called C:\data.csv that I use for filesystem tests.

   You can use this code in your access code. I am assuming you will know the path to the file you are working with. If so, then capture the path in a variable, and rewrite the code like this:

'----------
Dim stPath As String
stPath = "C:\data.csv"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(stPath)
stLongDate = objFile.DateCreated
DateArray = Split(stLongDate, " ")
stShortDate = DateArray(0)
WScript.Echo stShortDate
'----------

Then just pass stShortDate in your code to addnew to your table.

HTH


mmcdonal
Reply With Quote
  #3 (permalink)  
Old July 18th, 2005, 05:21 AM
Authorized User
 
Join Date: Jul 2005
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanx again,

This works like a clockwork. Got one set of problems solved.

Axxess

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo Box dependent transferred to another form Ebaad Access VBA 1 May 17th, 2007 12:50 PM
Capturing\Reading File Contents into DB with PHP aingalsbe PHP How-To 2 December 30th, 2005 09:48 AM
Session is not getting Transferred in servlets. saikrishna Classic ASP Basics 1 July 9th, 2004 11:57 PM
Date issues with ADP file Wango Access 2 June 15th, 2004 04:22 AM
Get file creation date shamsad Oracle 0 February 6th, 2004 06:59 AM



All times are GMT -4. The time now is 09:32 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.