N
Nicolae Fieraru
Hi All,
I have a continuous form and I display various records in it. Beside these
records, I added an image and I want to use VBA to display the image
corresponding to the specific record. Using the code in the OnCurrent event
seems to be executed only once, for all the records, not for every record
and every record displays the image of the first record.
I used the following code in the OnCurrent event of the form:
Private Sub Form_Current()
Dim ImgPath
On Error Resume Next
If (Len(gImagePath) = 0) Then
modVars.InitVars
End If
ImgName = Me![JigImage]
If (Len(ImgName) > 0) Then
ImgPath = gImagePath & GenFolderName(JigNo) & JigImage
Me![ImgPath].SetFocus
Me![ImgPath].Text = ImgPath
Else
ImgName = "noimg.jpg"
ImgPath = gImagePath & ImgName
Me![ImgPath].SetFocus
Me![ImgPath].Text = ImgPath
End If
If FileExists(ImgPath) Then
Me![ImageFrame].Picture = ImgPath
Else
ImgName = "noimg.jpg"
ImgPath = gImagePath & ImgName
Me![ImageFrame].Picture = ImgPath
End If
End Sub
Any idea would be appreciated.
Regards,
Nicolae
I have a continuous form and I display various records in it. Beside these
records, I added an image and I want to use VBA to display the image
corresponding to the specific record. Using the code in the OnCurrent event
seems to be executed only once, for all the records, not for every record
and every record displays the image of the first record.
I used the following code in the OnCurrent event of the form:
Private Sub Form_Current()
Dim ImgPath
On Error Resume Next
If (Len(gImagePath) = 0) Then
modVars.InitVars
End If
ImgName = Me![JigImage]
If (Len(ImgName) > 0) Then
ImgPath = gImagePath & GenFolderName(JigNo) & JigImage
Me![ImgPath].SetFocus
Me![ImgPath].Text = ImgPath
Else
ImgName = "noimg.jpg"
ImgPath = gImagePath & ImgName
Me![ImgPath].SetFocus
Me![ImgPath].Text = ImgPath
End If
If FileExists(ImgPath) Then
Me![ImageFrame].Picture = ImgPath
Else
ImgName = "noimg.jpg"
ImgPath = gImagePath & ImgName
Me![ImageFrame].Picture = ImgPath
End If
End Sub
Any idea would be appreciated.
Regards,
Nicolae