Solved

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

Posted on 2012-03-21
4
329 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

730 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