database import question

A

Andrew King

I have managed to import an excel file into an access database. What I also
want to do is import the filename of the excel spreadsheet but I am unable
to do this. Can anyone help me with thiis?

Thank you in advance.
 
J

John Nurick

Hi Andrew,

It can be done, but since you don't say where you want the filename to
end up after being "imported" it's not possible to be specific.

You'll need to write VBA code. The general idea is

1) Get the filename. If you are using Access 2002 or later, you can do
this with the FileDialog() function; in earlier versions the best way is
to use the code at http://www.mvps.org/access/api/api0001.htm

2) Pass the filename to DoCmd.Transferspreadsheet to import it.
 

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