import data from .csv file automatically

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like for data to be imported into a table each time i open a form.
the .csv file is updated every data from a query i run in AS400. can someone
tell me how I can automatically create/update a table in ms access from the
..csv file every time the form is opened?

thanks in advance,
geebee
 
Set up an Import Specification for the file. That is, use the file and
manually walk through an import. Start from the menu with File, Get External
Data, Import and select your csv file. Once you are in the wizard, click on
the Advanced command button. From there you can identify the field names and
data types you want to import and give it a Specifications Name. Now you can
use that specification name in a TransferText method to automate the import.
If you want to do it each time the form is open, Do the TransferText in the
Load event of the form.

The downside is the form will appear to the user to be slow to load because
it is transfering the data to whatever table you want to put it in. You may
want to consider loading the form without doing the import and put a command
button on the form to do the import. That way, the form will load much more
quickly (relative speed will depend on the size of the file) and the user
will have control over whether the file is imported.

If you are thinking, "I can't do that! What if the user forgets to load the
file?" Not a problem, instead of the command button, put a message box in
the load event saying "Do You Want To Load the File?" so they don't forget.
 
Thanks. I got it to work. However, I do not want the table to be opened as
a result of the import for the user to see the table. I just want the import
done behind the scenes and for the user to not have the table popup for him
to see. what else do i need to do?

thanks in advance,
geebee
 
Back
Top