Solved

script or method to unzip files deposited daily in a folder and load to an access table

Posted on 2012-03-21
4
324 Views
Last Modified: 2012-03-21
Hello,

I have a need to achieve the following:

load information from a file "abc1.dat.zip" into an access database

There is a new file deposited everyday. Presumably the naming convention will be standardized and incremented by 1

The files are not cumulative and, thus, need to be appended to the whatever information is already existing in the database table.

would it be preferable to unzip the files and combine them OUTSIDE of access and link to THAT file

OR...

Unzip the latest file and append that information to the existing access table.

This is a windows environment...

I hope I am explaining this properly and any assistance is greatly appreciated.

Thanks!

PLS
0
Comment
Question by:pls123
  • 2
  • 2
4 Comments
 
LVL 26

Expert Comment

by:Nick67
ID: 37749358
There's a fair bit of heavy lifting there, much more than is suitable to a single question.
You can use the TextStream object to create new textfiles and the OpenAsTextStream sub method of the FileSystemObject GetFile method to read and write to varying kinds of textfiles.

What type of format is your .dat file and how familiar are you with VBA and the FileSystemObject?
0
 

Author Comment

by:pls123
ID: 37749428
Hi,

The file format is variable length text records with a | delimiter.

I have a very basic familiarity with VBA.  I am not familiar in particiular with the filesystemobject, as usually I am just executing scripts and not writing them.

should I break out the question into multiple parts?
a) unzip files
b)write to a text file
c) automatically import and append a text file to an existing microsoft access table?

Thanks!
0
 
LVL 26

Accepted Solution

by:
Nick67 earned 500 total points
ID: 37749541
I think you'd have better results from multiple questions, yes.

1) How can I use VBA to unpack a file from a zipfile that gets created in a known file system location?

2) <<This can be straightforward, and you may already know how>> How can I link to a delimited textfile as an Access table?

3) How can I use OpenAsTextStream to append the contents of one text file to another?

#2 can get a little tricky pre-Access 2007 as the linking wizard can mis-label some of the field types.

If you create one single linked table, and append new data to that linked textfile, there won't need to be any appending within Access.  It'll happen when the textfiles get merged.

You should also state what version of Access you are targetting
0
 

Author Comment

by:pls123
ID: 37749605
I know that we are using access 2007.  I will close this question and re-submit as multiple questions.

Thanks!
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now