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!

Get next filename

Status
Not open for further replies.

macca007

Programmer
May 1, 2004
86
GB
Hi the code below gets images stores the id and filename to the table tExternal.

My problem is highlighted in red, what seems to happen it only pics the first filename and copies that to the database.
eg.

id hospno
1 snap1.jpg
2 snap1.jpg
3 snap1.jpg

What i would like it to do is move to the next filename and copy that to hospno e.g


id hospno
1 snap1.jpg
2 old.jpg
3 snap3.jpg

I know am nearly there of solving this one but need some assitance with this.


Private Sub DBPixMain_ImageModified()
Dim strFileName As String
Dim strFolderName As String, strDirectory As String

DBPixThumb.Image = Null ' Clear the thumbnail
Me("ThumbWidth") = 0 ' Reset image info (and force update of Id if new record)
Me("ThumbHeight") = 0
Me("DetailWidth") = 0
Me("DetailHeight") = 0

strDirectory = "C:\Database\Images\"
' strTest = GetFileName(strFolderName)

strFileName = Dir(strDirectory & "*.*", vbNormal)
' Me.txtFileHyperlink = strInputFileName


'
If DBPixMain.ImageBytes > 0 Then
' Update the thumbnail
DBPixThumb.ImageLoadBlob (DBPixMain.Image) ' Copy/Paste is faster, if you don't mind overwriting the clipboard
' DBPixMain.ImageCopy
' DBPixThumb.ImagePaste
''
If DBPixMain.ImageSaveFile(GetImgFolder & Me!ItemId & ".jpg") Then
Do
Me("hospno") = strFileName
Exit Do
Loop


' Me("DetailWidth") = DBPixMain.ImageWidth ' Uppdate Detail image info
' Me("DetailHeight") = DBPixMain.ImageHeight
'
If DBPixThumb.ImageSaveFile(GetImgFolder & "t" & Me!ItemId & ".jpg") Then
' Me("ThumbWidth") = DBPixThumb.ImageWidth ' Update the thumbnail image info
' Me("ThumbHeight") = DBPixThumb.ImageHeight
End If
End If
End If
End Sub


Many thanks
 
In the VBA help file take a look at the Dir function (with and without argument ...)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top