473,395 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Import text files dated after last information imported

Hi all,

Here's the situation. We are sending out a survey and tracking who we send it to. The automated system that sends the survey generates a text file called "surveydd mmm yyyy.txt" every time a survey is sent (with the date being the date the survey is sent).

I have created a macro in Access that imports this kind of text file and I have saved the specifications. That all works perfectly.

What I need help with is the code (macro/Visual Basic) that will decide which files to import.

Essentially, the macro should import any file that has a date in the file name after the date of the last survey sent in the tblSurveysSent (field name SurveyDate). As long as the date in the text file name is after the date of the last record (most recent record) in tblSurveysSent, I would like to import that text file (or more than one text file).

How do I do this? If there's any other information that would be helpful to provide, please let me know.

Thank you very much.
Jan 27 '09 #1
2 1732
ChipR
1,287 Expert 1GB
I just happened to be reading TheScripts Tip of the Week # 44 - Microsoft Scripting Runtime #2 by Adezii today, and it seems like you could use it.
Although I didn't see it mentioned in that post, the SystemFileObject has a Files collection that you can use to get all the filenames in a folder. There is even some sample code in MSDN Developer Network Library.
Jan 27 '09 #2
NeoPa
32,556 Expert Mod 16PB
There is a Dir() function in standard VBA which gives the same functionality Chip (at least as much as required here).

I would start by setting a Date/Time variable to the date after which files you are interested in.

Use Dir() (or similar) to get a list of matching files.

Go through each filename and extract the date portion, convert that into a Date/Time and compare with the previous variable (date you're interested in). If it is after that, then process the file. Otherwise move on to check the next.
Jan 28 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: David Berry | last post by:
Hi All. I'm looking for any help or sample code that can show me how to make a file import wizard in ASP.NET (VB preferred) like the one that MS Access uses. I'm working on a web site where the...
3
by: deko | last post by:
I've been trying to use the Access Import Wizard to expedite importing data into my mdb. The nice thing about the wizard is that I can import from different file formats - txt, xls, even Outlook -...
10
by: shumaker | last post by:
I don't need a detailed description of a solution(although I wouldn't mind), but I am hoping someone could tell me in general the best path to go about accomplishing a task, since I don't know all...
2
by: Phil Latio | last post by:
We have despatch process which kicks out picking information into text files at hourly intervals. The text files are named sequentially by process; 'ABC.txt', 'ABC01.txt', 'ABC02.txt' for one...
4
by: Bruce W. Roeser | last post by:
All, I'm reading a book by Charles Petzold (Programming VS.Net). Pretty good content but am confused about the difference. From the text: ...
11
by: kaisersose1995 | last post by:
Hi, I've got an import procedure working, using a standard import specification to import a .csv file into a temporary table. The problem i'm having is that i have 4 different sets of borrower...
2
by: KingoftheKings | last post by:
I'm new here. I want a help with VB codes that will import text or excel files from a specified directory in to an existing or new Access table. I have written some codes, but when I click the...
5
geolemon
by: geolemon | last post by:
Import text wizard says: I'm banging my head on this one, here's why: I've been importing files using this process and data format, with success! I created a temporary table in Access to...
6
by: provor | last post by:
Hello, I have the following code that I am using when a user presses a button to import an excel file into a table. The code is hard coded to point to the correct table. This works great for this...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.