Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch uploading photos and adding user defined info to all images

Status
Not open for further replies.

ncalcaterra

Programmer
Nov 11, 2004
27
US
I have a form (fUploadImages_Batch). The form contains 3 objects:

txtPhotoBy
txtPhotoDate
btnBatchLoad

The record source of the form is a table called "tImages" and contains the following fields:
ItemId = AutoNumber
PhotoBy = Text(255)
PhotoDate = Date/Time
ImgFileName = Text(255)
ImgDetail = OLE Object
DetailWidth = Number (Long Int)
DetailHeight = Number (Long Int)
ImgThumbnail = OLE Object
ThumbWidth = Number (Long Int)
ThumbHeight = Number (Long Int)

The following code is for the btnBatchLoad in the fUploadImages_Batch form:
Option Compare Database
Option Explicit

' Batch-Load button clicked: Load an entire folder of images (into new records)
Private Sub btnBatchLoad_Click()
On Error GoTo Finish

Dim strFile As String
Dim strFullPath As String
Dim strFolderName As String


' Display a 'Browse for folder' dialog - see 'BrowseForFolder' module
strFolderName = BrowseFolder("Select folder to load images from")

If Not IsEmpty(strFolderName) And Not strFolderName = "" Then
strFile = Dir(strFolderName + "\" + "*.jpg", vbNormal)

While (Not StrComp(strFile, ""))
If Len(strFile) > 1 Then
strFullPath = strFolderName + "\" + strFile
DoCmd.GoToRecord , , acNewRec
If DBPixMain.ImageLoadFile(strFullPath) Then
= strFile
End If

End If
strFile = Dir
Wend
End If

Finish:

End Sub

Everything works great, the image is uploaded both as an original as well as a thumbnail version and their height/width of each. Also uploaded into a separate field is the actual filename itself (ImgFileName).

The btnBatchLoad uploads all images contained in the directory selected.

Here is my issue:
I would like to enter the PhotoBy and PhotoDate in the text fields on the form, click the Batch Load command button and have the PhotoBy and PhotoDate values from the form be added to the table for ALL the images uploaded in the batch upload. I was able to get it to add the values to the first photo, but not the remaining photos.

Any help would be great - thanks to all.
 
Maybe I'm just missing something. Where are the 2 values you're wanting applied at all in this code? All I see in the code is dealing with the file path, folder, and name.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top