Importing .txt file into Access Table - Want Prompt

P

pilk00

I finally got my button to work - to import a single .txt file from a
specific location using either 1) a macro or 2) code. I'm using
"acImportFixed" to distribute the data into 3 separate fields.

What I'm not sure about is this: When the user clicks on the "Import Txt
File" button on my form, I'd like him to get a window or prompt of some kind
asking him to enter the name/location of the file. Or ask him to find the
file - like the import window does when you click on "get external data". I
don't want the user to have to go through all the import steps however. Just
choose a file and voila it's imported.

Thanks for any help on this problem!
 
D

Daniel Pineault

Use the Windows File Open/Save dialog box API found at

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

to prompt your user to locate the file to import. If you really want to get
fancy you can even incorporate the Special Folder's location API to make the
dialog open in a specific folder (Desktop, My Documents, ...), It can be
found at

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

Then with the file you can run the code you have already developed.
--
Hope this helps,

Daniel Pineault
For Access Tips and Examples: http://www.cardaconsultants.com/en/msaccess.php
If this post was helpful, please rate it by using the vote buttons.
 

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