Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 14th, 2005, 01:49 AM
Authorized User
 
Join Date: Jul 2005
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.

 
Old July 15th, 2005, 07:27 AM
Friend of Wrox
 
Join Date: Mar 2004
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
 
Old July 18th, 2005, 05:21 AM
Authorized User
 
Join Date: Jul 2005
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






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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.