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

synchronizing folder and database

kmpltd
P: 12
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.
Jan 1 '08 #1
Share this Question
Share on Google+
4 Replies


ADezii
Expert 5K+
P: 8,638
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.
Jan 1 '08 #2

NeoPa
Expert Mod 15k+
P: 31,494
The Dir() function should give you access to the information you require.
Let us know how you get on.
Jan 2 '08 #3

kmpltd
P: 12
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.
Jan 4 '08 #4

NeoPa
Expert Mod 15k+
P: 31,494
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.
Jan 5 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.