dbTalk Databases Forums  

Import Pics from folder...

comp.databases.ms-access comp.databases.ms-access


Discuss Import Pics from folder... in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Josh
 
Posts: n/a

Default Import Pics from folder... - 12-18-2004 , 11:50 PM






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?


Reply With Quote
  #2  
Old   
Larry Linson
 
Posts: n/a

Default Re: Import Pics from folder... - 12-19-2004 , 12:15 AM







"Josh" <josharmstrong (AT) socal (DOT) rr.com> wrote

Quote:
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




Reply With Quote
  #3  
Old   
pietlinden@hotmail.com
 
Posts: n/a

Default Re: Import Pics from folder... - 12-19-2004 , 02:44 PM




Josh wrote:
Quote:
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.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.