Usinf a form button to import a TEXT file

AshikHusein

Registered User.
Local time
Yesterday, 20:37
Joined
Feb 7, 2003
Messages
147
I would like to program a button on a form which does the folllowing:

1. It opens a particular file folder on a drive. (say U://)

2. It then allows to select a file ( which is a TEXT file) from this folder.

3. After the selection is made, it imports the TEXT file into ACCESS as an ACCESS table. ( The imprted TEXT file is also a Table).

I am relatively new to ACCESS and am pretty lost as to how to go about doing this. Thanks.
 
You can either build your own interface for opening files by filling a listbox with the names of files inside a folder, or using the Common Dialog Box controls within Access. See the following Microsoft Knowledge Base article on how to use the Common Dialog box in Access. That will allow you to open the standard file dialog box, allowing your user to select a file. How to Use the Common Dialog API in an Access Database

Once you have the filename you want, you would use the DoCmd.TransferText command in code to pull the file in.

There are just too many commands and steps to explain here in one post. Why don't you start putting together the form and ask us questions as you go along?
 
I will ask as I go along. Thanks!

Thanks! I will try to understand the process and ask questions as I go. And by the way can you recommend a good book which deals in VBA for Excel and ACCESS? I have bought the ACCESS and EXCEL bibles but they have a very surface treatment for VBA. These have helped me quite a bit to learn VBA but I would like someting more involved and systematic. Thanks again!
 

Users who are viewing this thread

Back
Top Bottom