Connecting Tech Pros Worldwide Help | Site Map

synchronizing folder and database

kmpltd's Avatar
Newbie
 
Join Date: Aug 2007
Location: Saskatoon, Saskatchewan
Posts: 12
#1: Jan 1 '08
Thanks to y'all, I have a photo database that works quite slickly. However, being kind of lax about such things, the linked folder (My Documents/My Photos/Database/) contains about fifty more photos than the database table [Photos]. Short of going over the whole thing file by file, of which there are fifteen hundred or so, is there a way to find out which photos are not entered in the database? I know how to do a query to find this sort of thing in tables, but not a folder.
Any hints?
Thanks in advance.
ADezii's Avatar
Expert
 
Join Date: Apr 2006
Location: Philadelphia
Posts: 5,213
#2: Jan 1 '08

re: synchronizing folder and database


Quote:

Originally Posted by kmpltd

Thanks to y'all, I have a photo database that works quite slickly. However, being kind of lax about such things, the linked folder (My Documents/My Photos/Database/) contains about fifty more photos than the database table [Photos]. Short of going over the whole thing file by file, of which there are fifteen hundred or so, is there a way to find out which photos are not entered in the database? I know how to do a query to find this sort of thing in tables, but not a folder.
Any hints?
Thanks in advance.

How are the Photos stored in the Database? Are they in an OLE Object Field (Linked/Embedded), are just the Paths to the Files stored in the Database (..MyDocuments/My Photos/Database/Filenames, are they stored as BLOBs (Binary Data in an OLE Object Field)? I think you get the idea.
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,672
#3: Jan 2 '08

re: synchronizing folder and database


The Dir() function should give you access to the information you require.
Let us know how you get on.
kmpltd's Avatar
Newbie
 
Join Date: Aug 2007
Location: Saskatoon, Saskatchewan
Posts: 12
#4: Jan 4 '08

re: synchronizing folder and database


I've looked at the Dir() function and that seems like the way to go, but I don't know exactly how to write the code. Hell, I don't know how to write code; I just bootleg it from you guys, for which I am grateful.
I'm assuming that the code ends up in an expression in a query, but as I say, I don't know.
All the photos are Jpegs in a single folder, the path to which is a field in the table.
Table: Photos
Field: txtImageName
FieldValue:
[C:\Documents and Settings\Ken Paulson\My Documents\My Pictures\Database\PhotoName.jpg] where PhotoName is the filename in the folder.
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,672
#5: Jan 5 '08

re: synchronizing folder and database


I can't develop the code for you as that's not what we're about here.
I appreciate you're not someone who likes to code from scratch so maybe a link (Basic DAO recordset loop using two recordsets) to some example recordset code will help.
Check out the help for the Dir() function. There is a piece of example code there too.
If you process through the directory using Dir() you can find if there is a match in your recordset. Alternatively you can use DLookup each time through the loop, but remember the performance may suffer.
Reply


Similar Microsoft Access / VBA bytes