external image processing

  • Thread starter Thread starter Robert M via AccessMonster.com
  • Start date Start date
R

Robert M via AccessMonster.com

I support an access97 database with one table. Each record has a text field
which contains a path pointing to a .jpg image stored in various folders on a
network server . I would like to consolidate all the images from the various
folders into one folder. Can anyone help me with a code example to retrieve
the images and write them to a new single folder?
 
Hi Robert

In VBA code, you can use the following built-in statements:

FileCopy <source file>, <destination file>
to copy a file from one place to another

FileCopy <source file>, <destination file>
Kill <source file>
to *move* a file from one place to another

Name <source file> As <destination file>
to rename a file and thus quickly move it from one folder to another *on
the same drive*

Now it's just a matter of going through your table, copying/moving each
file, updating the file path in the table, and going to the next record.

Note: you must be prepared for the eventuality of two source files having
the same name!
 
Graham,
Thanks, exactly what I was looking for! Apologize for late response -
overwhelmed with projects. I have another question if you don't mind...
let's say I want to verify what I've written or use it as input to another
task, how do I Read the file? Thanks much.

Graham said:
Hi Robert

In VBA code, you can use the following built-in statements:

FileCopy <source file>, <destination file>
to copy a file from one place to another

FileCopy <source file>, <destination file>
Kill <source file>
to *move* a file from one place to another

Name <source file> As <destination file>
to rename a file and thus quickly move it from one folder to another *on
the same drive*

Now it's just a matter of going through your table, copying/moving each
file, updating the file path in the table, and going to the next record.

Note: you must be prepared for the eventuality of two source files having
the same name!
I support an access97 database with one table. Each record has a text
field
[quoted text clipped - 5 lines]
retrieve
the images and write them to a new single folder?
 
Hi Robert

Sorry, I don't understand. These are JPG files, right? What do you mean
when you say you want to "read the file" or "use it as input to another
task"?
--

Graham Mandeno [Access MVP]
Auckland, New Zealand

Robert M via AccessMonster.com said:
Graham,
Thanks, exactly what I was looking for! Apologize for late response -
overwhelmed with projects. I have another question if you don't mind...
let's say I want to verify what I've written or use it as input to another
task, how do I Read the file? Thanks much.

Graham said:
Hi Robert

In VBA code, you can use the following built-in statements:

FileCopy <source file>, <destination file>
to copy a file from one place to another

FileCopy <source file>, <destination file>
Kill <source file>
to *move* a file from one place to another

Name <source file> As <destination file>
to rename a file and thus quickly move it from one folder to another
*on
the same drive*

Now it's just a matter of going through your table, copying/moving each
file, updating the file path in the table, and going to the next record.

Note: you must be prepared for the eventuality of two source files having
the same name!
I support an access97 database with one table. Each record has a text
field
[quoted text clipped - 5 lines]
retrieve
the images and write them to a new single folder?
 
Graham said:
Hi Robert

Sorry, I don't understand. These are JPG files, right? What do you mean
when you say you want to "read the file" or "use it as input to another
task"?
Graham,
Thanks, exactly what I was looking for! Apologize for late response -
[quoted text clipped - 28 lines]

I will be modifying the database .jpg path field to point to the new file
location as I write it so I also want to write a routine that I'll run later
that will verify that the path field and .jpg are in sync. Thanks.
 
I will be modifying the database .jpg path field to point to the new file
location as I write it so I also want to write a routine that I'll run
later
that will verify that the path field and .jpg are in sync. Thanks.

How do you define "in sync"? Do you mean that you want to verify that the
path is valid and the file exists?
 
Graham said:
How do you define "in sync"? Do you mean that you want to verify that the
path is valid and the file exists?

Graham,
Yes, that's exactly what I'd like to do.
 
Ah...

The following function will do that for you:

Public Function FileExists(sPath As String) As Boolean
On Error Resume Next
FileExists = Len(Dir(sPath, vbSystem Or vbHidden)) <> 0
If Err Then
FileExists = False
Err.Clear
End If
End Function
 
Thanks again, Graham - just what I needed.

Graham said:
Ah...

The following function will do that for you:

Public Function FileExists(sPath As String) As Boolean
On Error Resume Next
FileExists = Len(Dir(sPath, vbSystem Or vbHidden)) <> 0
If Err Then
FileExists = False
Err.Clear
End If
End Function
[quoted text clipped - 7 lines]
Graham,
Yes, that's exactly what I'd like to do.
 

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

Back
Top