transfertext - select text file?

  • Thread starter Thread starter HX
  • Start date Start date
H

HX

Hello,

I need to modify a simple database application that imports data from a text
file into the active database. Currently the process is done using forms
and a set of macros, and the function used is TransferText and an import
spec.

As it stands, the user is expected to find the file to be imported, and
verify the name and location of the file so that TransferText will find it
and be able to import it.

What I want to do, however, is change the functionality so that the user can
FIND the file they want to import using the usual window we see when
File/Open is selected. The rest of the process, however, still needs to
be transparent to the user (the spec to use for the import, the
name/location of the imported file) -- I just want them to be able to select
the file to import from a window or list.

Can someone point me to a tutorial or place where I can learn how to code
this? I haven't worked much with Access in the past 10 years, and much has
changed since then. It doesn't help that I don't know VB well, either. : (

I appreciate any pointers to a starting place!
 
HX said:
Hello,

I need to modify a simple database application that imports data from a
text file into the active database. Currently the process is done using
forms and a set of macros, and the function used is TransferText and an
import spec.

As it stands, the user is expected to find the file to be imported, and
verify the name and location of the file so that TransferText will find it
and be able to import it.

What I want to do, however, is change the functionality so that the user
can FIND the file they want to import using the usual window we see when
File/Open is selected. The rest of the process, however, still needs
to be transparent to the user (the spec to use for the import, the
name/location of the imported file) -- I just want them to be able to
select the file to import from a window or list.

Can someone point me to a tutorial or place where I can learn how to code
this? I haven't worked much with Access in the past 10 years, and much
has changed since then. It doesn't help that I don't know VB well,
either. : (

I appreciate any pointers to a starting place!

You need to use one of two options to allow the user's to select the file:

1. The FileOpen dialog box (access through an API call).
2. The common dialog control.

Both have their advantages and disadvantages. Option 2 is probably the
simpler, however I have run into problems when users have had different
versions of the necessary DLL. Option 1 is more complex, however (in my
experience, at least) there are fewer file version problems.

Walkthroughs of the two are here:

http://www.mvps.org/access/api/api0001.htm

http://www.developerfusion.co.uk/show/11/

Once you have used one of these two methods you can pass the return value
(the file path to the selected file) to import your data using
DoCmd.TransferText.

If you need anymore info feel free to post back!

Ed Metcalfe.
 
Hello, Ed, and thanks!

I'd like to try your option 1 - but I'm not really sure what goes where, or
how to call it. Is that simple to explain? If not, I guess I'll bark up
option 2 for starters.

?!
 
Back
Top