Rename and Relocate an Image tif file from information within DB

JohnLee

Registered User.
Local time
Yesterday, 22:54
Joined
Mar 8, 2007
Messages
692
Good afternoon folks,

I import fixed width text files into my database which a scanning system exports to a specific location. The scanning system also exports the images that pertain to each record within that text file to a specific location.

In the text file there is a field which provides information pertaining to the location of the specific image of each record in the text file.

The Image folder is structured as follows:

H:\Images\20120103\00039706_DOMESTICGENERAL_001\00039706_DOMESTICGENERAL_001_1.tif

H:\ is the directory identifier

Images\ is the folder in which all images output from the scanning system reside.

20120103\ is date the images and text file were exported from the scanning system.

00039706_DOMESTICGENERAL_001\ is the batch name of all records in the text file with that name included in the record.

00039706_DOMESTICGENERAL_001_1.tif is the image number within the batch that pertains to the record in the text file.

The date will change daily according to when a text file is output.

The Batch Name will change according to how many batches are exported each day as will the image number.

There can be multiply batches output for the same date in the same text file i.e.

00039706_DOMESTICGENERAL_001
00039707_DOMESTICGENERAL_001
00039708_DOMESTICGENERAL_001
00039709_DOMESTICGENERAL_001

And each batch can have a different number of records that pertain to it in the output text file i.e.

00039706_DOMESTICGENERAL_001\00039706_DOMESTICGENERAL_001_1.tif
00039706_DOMESTICGENERAL_001\00039706_DOMESTICGENERAL_001_2.tif
00039706_DOMESTICGENERAL_001\00039706_DOMESTICGENERAL_001_3.tif

00039707_DOMESTICGENERAL_001\00039706_DOMESTICGENERAL_001_1.tif
00039707_DOMESTICGENERAL_001\00039706_DOMESTICGENERAL_001_2.tif
00039707_DOMESTICGENERAL_001\00039706_DOMESTICGENERAL_001_3.tif

Etc

The following 3 fields within the output fixed width text file contain the information needed to create the process required, which is as follows:

strPlanNumber [text field], field length is 10
strFormCode [text field], field length is 4
strImagePath [text field], field length is 150

I have been requested to create a process that renames and relocates the image output from the scanning system as follows:

Using the strImagePath field information rename the image to the strPlanNumber field information, then relocate the
image to a new folder called “StandardQuesByForm” , create another folder if one doesn’t exist within that folder using
the the current date [Format yyyymmdd] and a further folder within that folder using the strFormCode
information. So it would look something like this:

StandardQuesByForm\20120104\14_Q\YTG0001576.tif

StandardQuesbyForm\20120104\20_Q\ZAN0016257.tif


I’m hoping the above has explained what it I need to do, I’m somewhat lost as to where to start in terms of VBA code with Access in order to achieve this, if it is possible to do.

I would be most grateful for any help, pointers, code samples that I could work with to do this.

Thanks in advance.
 

Users who are viewing this thread

Back
Top Bottom