VB/Access 2003 and file operations

L

Larry Linson

File, Get External Data, Import, choose Text Files... and follow the
prompts. That's a start.

Larry Linson
Microsoft Access MVP
 
J

John Nurick

Hi Alan,

There are the antique Basic file I/O statements (Open, Line Input, etc)
or the newer FileSystemObject object (in the Microsoft Scripting Runtime
library) which has a TextStream object with ReadLine and similar
methods.

As well as the classic string handling functions (Instr(), Mid() etc)
there's also a Split() function which parses a simple delimited line
into an array. The VBScript Regular Expression object is fairly powerful
(the regex syntax is AFAIK the same as Perl 5.0 or thereabouts) and
easily used in VB or VBA code.

John
 
N

Nikos Yannacopoulos

Alan,

Another way to do it is to follow Larry Linson's suggestion just so you
create an import specification, to then use in your code as an argument in a
DoCmd.TransferText method. It works quite well!

HTH,
Nikos
 
A

Alan Reinhart

New to Access 2003 & VB.

I'd like to open some tab-delimited files and parse out selected text and
put it in some Access tables. In other systems this kind of stuff came under
the heading of "File Operations". Under what category are these functions or
operations found in VB?

Like:
OPEN a file;
READ records (lines of text terminated by some NewLine char
On EOF - CLOSE the file or stream.

=Alan R.
 
A

Alan Reinhart

Thanks! - but I was looking more for the VB functions or commands so
I can write a method or procedure to do the grunt work.

I just want the user to navigate to the file anywhere on the disk, and then
from a VB method or subroutine open the file and handle all the extraction
and
and insertion into the database tables. The info is coming from a big report
and there is a lot of extraneous data that needs to be skipped over. Like
780 pages of stuff! The report layout is not uniform enough to just pull
into a spreadsheet window and work with it.

=Alan R.
 
A

Alan Reinhart

the newer FileSystemObject object (in the Microsoft Scripting Runtime
library) which has a TextStream object with ReadLine and similar

Thanks John - just what I was looking for!

=Alan R.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top