VB/Access 2003 and file operations

  • Thread starter Thread starter Larry Linson
  • Start date Start date
L

Larry Linson

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

Larry Linson
Microsoft Access MVP
 
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
 
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
 
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.
 
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.
 
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.
 
Back
Top