| | | Batch-loading & processing images with Microsoft Access | Check the Support pages for samples using this and similar techniques. This code Loads all the image files in a particular directory into a database. The images would be processed according to the DBPix control's settings (eg any resampling, compression). This code could be extended to automatically create thumbnails or work with external files as required. You could move the processed original files to an "archiving" directory, possibly on CD, move any files which failed to load to an "Errors" folder etc.
Private Sub BatchLoad_Click() On Error GoTo Finish Dim szDir As String Dim szSearchSpec As String Dim szFile As String Dim szFullPath As String szDir = "C:\images\ 'The source directory for our images szSearchSpec = szDir + "*.jpg" 'Filespec for directory listing szFile = Dir(szSearchSpec, vbNormal) 'Generate a list of matching files While (Not StrComp(szFile, "")) If Len(szFile) > 1 Then szFullPath = szDir + szFile DBPixCtl.ImageLoadFile (szFullPath) 'Load the file DoCmd.GoToRecord , , acNewRec 'Move the recordset cursor to the next image End If szFile = Dir 'Get the next filename from the directory listing Wend Finish: End Sub
| |
|
|