chenwenjun
Technical User
Last time, at this forum, I asked If I could view my pictures stored in certain folders in FORM without inserting or linking because of the problem of file size.
And Gusbrunston helped me greatly by introducing me the function as followed. But I am still seeking EVEN BETTER solution.
This one serves my needs perfectly in SINGLE FORM,however, when I view my pictures in a continuous form, all pictures are the same one (the one belongs to the actived record!).[/red]
Is that possible that I can have a continuous form which shows records with their own picture?
Function setImagePath()
Dim strImagePath As String
Dim strMDBPath As String
Dim intSlashLoc As String
On Error Goto PictureNotAvailable
'Obtain the full path of the current database or Access Project
strMDBPath = CurrentProject.FullName
'Find the location of the last backslash
intSlashLoc = InStrRev(strMDBPath, "\", Len(strMDBPath))
'Trim off the database name, leaving the path
'and append the name of the image file
strImagePath = Left(strMDBPath, intSlashLoc) & _
Me.txtImageName
'Set ImageFrame to the path of the image file
Me.ImageFrame.Picture = strImagePath
Exit Function
PictureNotAvailable:
strImagePath = "NoPicture.BMP"
Me.ImageFrame.Picture = strImagePath
End Function
"Learn till the last breath."
And Gusbrunston helped me greatly by introducing me the function as followed. But I am still seeking EVEN BETTER solution.
This one serves my needs perfectly in SINGLE FORM,however, when I view my pictures in a continuous form, all pictures are the same one (the one belongs to the actived record!).[/red]
Is that possible that I can have a continuous form which shows records with their own picture?
Function setImagePath()
Dim strImagePath As String
Dim strMDBPath As String
Dim intSlashLoc As String
On Error Goto PictureNotAvailable
'Obtain the full path of the current database or Access Project
strMDBPath = CurrentProject.FullName
'Find the location of the last backslash
intSlashLoc = InStrRev(strMDBPath, "\", Len(strMDBPath))
'Trim off the database name, leaving the path
'and append the name of the image file
strImagePath = Left(strMDBPath, intSlashLoc) & _
Me.txtImageName
'Set ImageFrame to the path of the image file
Me.ImageFrame.Picture = strImagePath
Exit Function
PictureNotAvailable:
strImagePath = "NoPicture.BMP"
Me.ImageFrame.Picture = strImagePath
End Function
"Learn till the last breath."