ncalcaterra
Programmer
Hi - I'm using this program DBPix and it's just great for what I need it to do. I can upload a batch of photos or a single photo, depending on my needs. My table for storing the images is pretty simple:
ItemID (autonumber)
ImgDetail (OLE Object)
DetailWidth (Number)
DetailHeight (Number)
ImgThumbnail (OLE Object)
ThumbWidth (Number)
ThumbHeight (Number)
ImgFileName (Text)
Below is the code for uploading the images (batch style). The only thing I'd like to alter about it, is to take the filename (just the filename, not the path) and add that to the "ImgFileName" field on it's own. I need to be able to use the filename for relationships down the road, so having this stored as text on its own would be extremely helpful.
Any help would be extremely appreciated!!!!
' 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
DBPixMain.ImageLoadFile (strFullPath)
End If
strFile = Dir
Wend
End If
Finish:
End Sub
ItemID (autonumber)
ImgDetail (OLE Object)
DetailWidth (Number)
DetailHeight (Number)
ImgThumbnail (OLE Object)
ThumbWidth (Number)
ThumbHeight (Number)
ImgFileName (Text)
Below is the code for uploading the images (batch style). The only thing I'd like to alter about it, is to take the filename (just the filename, not the path) and add that to the "ImgFileName" field on it's own. I need to be able to use the filename for relationships down the road, so having this stored as text on its own would be extremely helpful.
Any help would be extremely appreciated!!!!
' 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
DBPixMain.ImageLoadFile (strFullPath)
End If
strFile = Dir
Wend
End If
Finish:
End Sub