Solved

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

Posted on 2012-03-21
4
327 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
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…

773 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