Hi Guys,
Hope you can help with this one, i am trying to add an image or all images within folder to inside of the table of pallet data
when i call AppendPalletData, all data is adding but not images
hope i have explained correct!!
Kindest
Code:
Private Sub AppendPalletData(ByRef strBody As String)
Dim sBase As String, strStartTime As String, strEndTime As String, strFS As String, strFE As String, strEORI As String, strGross As String
Dim strSpan As String, strSpanEnd As String, strRef As String, strFontBlue As String, sDealer As String, strPalletSize As String, strTotalWgt As String, sPath As String, sFiles As String
Dim rs As DAO.Recordset
Dim lngPalletWgt As Long, lngTotalPalletWgt As Long
Dim iTotalItems As Integer, iPalletQty As Integer
Dim sDenDest As String, sColDest As String, strPC As String
strPC = DLookup("PostCode", "tblCollections", "[CollectNow] = Yes")
sDealer = DLookup("DelTo", "tblCollections", "[CollectNow] = Yes")
sBase = "Warehouse Postcode"
sEndDest = "<a href='https://www.google.co.uk/maps/dir/" & Replace(strPC, " ", "") & "'>" & "View End Destination:" & "</a><br><br>"
sColDest = "<a href='https://www.google.co.uk/maps/dir/" & Replace(sBase, " ", "") & "'>" & "View Collection Location:" & "</a>"
strSpan = "<span style='background:yellow'>"
strSpanEnd = "</span>"
strFS = "<font size='3' face='arial' style='text-align=center'; vertical-align='middle'>" ' Mail Font
strFE = "</font>" ' End Font'
strBoxStart = "<script><table width='auto';style='text-align:left;border:1px solid black;font-family:arial;border-collapse:collapse;padding:10px'><tr style='background:white;mso-highlight:blue' ctx.shadowblur;20; ctx.shadowcolor;blue></script>"
strBoxEnd = "</tr></table>"
sFH = "<font size='4' face='Calibri' style='text-align=center; vertical-align='middle'>"
sFHEnd = "</font>"
strFontBlue = "<B><font color='blue'></B>"
'PALLET SIZES
Set rs = CurrentDb.OpenRecordset("Select * From tblPalletsTemp")
Do Until rs.EOF
strPalletSize = strPalletSize & "<li> " & rs.Fields("Pallets") & "<br>"
rs.MoveNext
Loop
'EORI
If Not IsNull(strEORI = DLookup("EORI", "tblDealers", "[PostCode] = '" & strPC & "'")) Then
strEORI = DLookup("EORI", "tblDealers", "[PostCode] = '" & strPC & "'")
Me.txtEORI = strEORI
Else
myEORI = "N/A"
End If
'PALLET QTY / WEIGHTS
'Select Case Me.cboPallets
'Case Is > 0
strBody = strBody & sFH & "<B>" & "Pallet Dimensions / Location" & "</B>" & sFHEnd & "<br><br>"
''strBody = strBody & _
lngPalletWgt = "20" ' EMPTY PALLET
iTotalItems = Me.txtTotalBoxes ' TOTAL ITEMS
strTotalWgt = "Estimated Total Nett Weight (Excl pallet): " & Me.txtTotalWeight & " " & "Kg's" 'TOTAL WEIGHT EXCL PALLET
'iPalletQty = Me.cboPallets 'TOTAL QTY OF PALLETS
iPalletQty = "1"
lngTotalPalletWgt = lngPalletWgt * iPalletQty
Me.txtGrossWeight = Left(lngTotalPalletWgt, 2) + Me.txtTotalWeight
strGross = "Estimated Total Gross Weight (Incl pallet): " & Me.txtGrossWeight & " " & "Kg's"
strSingleWgt = "Estimated Weight Per Pallet: " & Me.txtGrossWeight / iPalletQty & " " & "Kg's"
strBody = strBody & _
"<table width='50%'>" & _
"<tr>" & _
"<th style='color: White; background-color: rgb(0,0,139);border:1px solid black;font-family:arial;border-collapse:collapse;padding:8px'>Pallet Details</th></tr>"
Select Case Me.optAddImages
Case Is = False
strBody = strBody & "<tr>" & _
"<td style='background-color:#F5F5F5;border:1px solid black;font-family:arial;border-collapse:collapse;padding:8px'>" & _
strFS & _
"<li>" & "Total Items: " & iTotalItems & "<br><br>" & _
"<li>" & strTotalWgt & "<br><br>" & _
"<li>" & "Total Pallets: " & iPalletQty & "<br><br>" & _
"<li>" & strSingleWgt & "<br><br>" & _
"<li>" & strGross & "<br><br>" & _
"<li>" & "Collection Location " & sColDest & "<br><br>" & _
"<li>" & "Onward Shipping Location " & sEndDest & "<br><br>" & _
strFE & "</td></tr>"
Case Else
Do While sFiles <> ""
strBody = strBody & _
"<table style='text-align:left;border:3px solid blue;font-family:arial;border-collapse:collapse;padding:5px'><br>" & _
"<font color='blue' font face='Times New Roman' size='3'>Image Name:<B> " & Replace(sFiles, ".jpg", "") & "</B></font>" & _
"<P><IMG border=2 hspace=0 alt='' src='file:" & sPath & sFiles & "' align=baseline></P>" & "<br>" & _
"</table><br>"
sFiles = Dir
Loop
strBody = strBody & "<tr>" & _
"<td style='background-color:#F5F5F5;border:1px solid black;font-family:arial;border-collapse:collapse;padding:8px'>" & _
strFS & _
"<li>" & "Total Items: " & iTotalItems & "<br><br>" & _
"<li>" & strTotalWgt & "<br><br>" & _
"<li>" & "Total Pallets: " & iPalletQty & "<br><br>" & _
"<li>" & strSingleWgt & "<br><br>" & _
"<li>" & strGross & "<br><br>" & _
"<li>" & "Collection Location " & sColDest & "<br><br>" & _
"<li>" & "Onward Shipping Location " & sEndDest & "<br><br>" & _
strFE & "</td></tr>"
'can i add images here inside thi table ?
End Select
Set rs = Nothing
strBody = strBody & "</table><br>"
End Sub