By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,446 Members | 3,120 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,446 IT Pros & Developers. It's quick & easy.

Need code to import files

P: n/a
Hello,

I have a directory on my company network that contains multiple
directories that each hold different files, some are dbf files and some
are xls files. I need my Access 2000 users to be able to click an
Import File button on a form and then a list of the multiple
directories would appear and they could open the particular directory
they want and double click on whichever dbf or xls they need and it
would automatically import. I have been looking for some code to do
this but haven't found exactly what I need. I would appreciate any help
that can be given.

Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
umm... Ken Getz's OpenSaveFile API at AccessWeb is your friend.
Then pass the result to whatever your import routine is...
Happy coding.

Nov 13 '05 #2

P: n/a
Farina wrote:
Hello,

I have a directory on my company network that contains multiple
directories that each hold different files, some are dbf files and some
are xls files. I need my Access 2000 users to be able to click an
Import File button on a form and then a list of the multiple
directories would appear and they could open the particular directory
they want and double click on whichever dbf or xls they need and it
would automatically import. I have been looking for some code to do
this but haven't found exactly what I need. I would appreciate any help
that can be given.


I don't have the solution but I do have a couple questions.

Is using the built-in Import function out of the question?

Assuming the answer to the first question is "no", do all the .xls files
have a layout that can be "automatically" imported without any tweaking?
If you have worked with importing .xls (I have not worked with .dbf)
you probably know that there are things to consider at import time,
e.g., which worksheet(s) to import, first row contains column
headings?, table name to create, which column(s) to index, what to do
about primary key, etc.

Just a thought.
--
Smartin
Nov 13 '05 #3

P: n/a
Thanks for responding. I had not considered using the built-in Import
function. A friend mentioned that I needed to use the Dir Function. All
the .xls and .dbf files will be different, but will only be one
worksheet and the first row will always be the headings. I would like
to be able to give the table a name upon import. There is no concern
about the index so whatever works. There is a company_id that will
always be used as the primary key.

Nov 13 '05 #4

P: n/a
Your best bet (from the limited information you've given) is probably
to create an import specification, name it, and then use it in your
loop that imports all the files. Look around the NG for examples of
DIR and that should get you going. You essentially throw in a
TransferSpreadsheet command inside the loop, and away you go.

Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.