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

Import Pics from folder...

P: n/a
Currently we open a form and manualy place the pic in each new record.
I need someway for to give Access a folder and then have it import each
pic it finds in the folder and place the file name in the txtFilename
text box. Can access do this?

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


P: n/a

"Josh" <jo***********@socal.rr.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Currently we open a form and manualy place the pic in each new record.
I need someway for to give Access a folder and then have it import each
pic it finds in the folder and place the file name in the txtFilename
text box. Can access do this?


You can write VBA code to do what you want, except do you really want all
the file path and names in the same Text Box? Wouldn't it be better, since
you are in "batch mode" of operation, to write each to a separate record in
the table itself?

Check help for the Dir function for "running the folder contents". See
http://www.mvps.org/access/api/api0001.htm for code to use the Windows
Common Dialog to let the user choose the folder.

Larry Linson
Microsoft Access MVP
Larry Linson
Microsoft Access MVP
Nov 13 '05 #2

P: n/a

Josh wrote:
Currently we open a form and manualy place the pic in each new record. I need someway for to give Access a folder and then have it import each pic it finds in the folder and place the file name in the txtFilename
text box. Can access do this?


I would vote for going Larry's route.
If you're looking for a way to prompt the user for a filename, you
could use Ken Getz's code from access web, it's the first one in the
API section. just write that value to your field on your form.

If you have a batch of these, you could do these as a group with the
Dir function and then some more code, but it depends entirely if you're
comfortable with/good at coding in VBA.

Being lazy, I'd write code that looped through the contents of a folder
and grabbed the info I needed and wrote it to the database. But that
will only work if your situation is right...

Umm... if all the files have unique names that can be linked to unique
records, you could use the BrowseFolder API to get the folder
containing all the pics, and then loop through the contents using DIR
and then write the values to a table via a recordset. But then, if you
don't know how to do any of that stuff, it's kinda a moot point, unless
you wanted to pay someone to do it for ya.

So, to answer your question, yes, Access can do it. How well it works,
though, depends on implementation, and that will most likely require
code, either the BrowseFolder API or the OpenSaveFile API...
BrowseFolder will work better if your naming conventions are good, and
will be easier to automate a batch "import" (link to the files, do NOT
import them - your database will get HUGE very quickly! - store just
the UNC path.) If you're doing this one file at a time, just use the
OpenSaveFile API, and grab the path to your file and write it to your
DB.

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.