Hi, All,
I made a form and placed image in, this image source in specific folder which is match with the ItemNo, means:
Database[ItemNo] = Folder[ItemNo.jpg] (if picture can't found then will display a unique picture - "No Picture")
This function made by VBA.
The problem when I print report then the image will show "No Picture" only, the original that I have pictures in each data, how can I make this print in report with image?
Here is the VBA quote:
Public Function GetPathPart() As String
***' Comments *: Returns the path part of a string
***' Parameters: strPath - string to parse
***' Returns **: path part
***'
***Dim db As DAO.Database
***Dim strPath As String
***Dim intCounter As Integer
***
***Set db = CurrentDb
***strPath = db.Name
***db.Close
***Set db = Nothing
*******
***For intCounter = Len(strPath) To 1 Step -1
If Mid$(strPath, intCounter, 1) = "\" Then
***********Exit For
*******End If
***Next intCounter
***
***GetPathPart = Left$(strPath, intCounter)
End Function
Private Sub Form_Current() 'Picture load
Cube = Me.txtCtnDimH * Me.txtCtnDimL * Me.txtCtnDimW / 1728
On Error GoTo err_Form_Current
***If Not Me!txtItemNo = "" Or Not IsNull(Me!txtItemNo) Then
*******Me!MtImage.Picture = GetPathPart & Me!txtItemNo & (".jpg")
***
***Else
*******Me!MtImage.Picture = ""
***End If
*******
exit_Form_Current:
***Exit Sub
***
err_Form_Current:
***Me!MtImage.Picture = GetPathPart & "NoPicture.jpg"
***Resume exit_Form_Current
End Sub
I made a form and placed image in, this image source in specific folder which is match with the ItemNo, means:
Database[ItemNo] = Folder[ItemNo.jpg] (if picture can't found then will display a unique picture - "No Picture")
This function made by VBA.
The problem when I print report then the image will show "No Picture" only, the original that I have pictures in each data, how can I make this print in report with image?
Here is the VBA quote:
Public Function GetPathPart() As String
***' Comments *: Returns the path part of a string
***' Parameters: strPath - string to parse
***' Returns **: path part
***'
***Dim db As DAO.Database
***Dim strPath As String
***Dim intCounter As Integer
***
***Set db = CurrentDb
***strPath = db.Name
***db.Close
***Set db = Nothing
*******
***For intCounter = Len(strPath) To 1 Step -1
If Mid$(strPath, intCounter, 1) = "\" Then
***********Exit For
*******End If
***Next intCounter
***
***GetPathPart = Left$(strPath, intCounter)
End Function
Private Sub Form_Current() 'Picture load
Cube = Me.txtCtnDimH * Me.txtCtnDimL * Me.txtCtnDimW / 1728
On Error GoTo err_Form_Current
***If Not Me!txtItemNo = "" Or Not IsNull(Me!txtItemNo) Then
*******Me!MtImage.Picture = GetPathPart & Me!txtItemNo & (".jpg")
***
***Else
*******Me!MtImage.Picture = ""
***End If
*******
exit_Form_Current:
***Exit Sub
***
err_Form_Current:
***Me!MtImage.Picture = GetPathPart & "NoPicture.jpg"
***Resume exit_Form_Current
End Sub