I posted something similar to this earlier but I got lost. I am trying it again. Many of the properties (buildings) that we do proposals for have a site plan. They are stored in a folder (or directory) just for them. There would be only one file for any given property. However, there could be a choice of one of many file types (extensions) as pdf, jpg, xls, and many more. I am trying to search for the file using the wildcard character '*'. Below is my code which does not return anything. The line in red is the line which should select the file. The variables 'strSitePlanLoc' and 'strPropertyName' produces the correct path and property name, but no file is attached. I can change the & ".*" to & ".pdf" and (provided there is a pdf file of that property) then the file is attached. Help is appreciated.
With rst
Do Until rst.EOF
strPropertyName = ![fTxtJobName]
lngProposalNo = ![fLngProposalNo]
' make sure a property is listed
If strPropertyName > "" Then ' contains a value
' then find the file
strFullFileName = strSitePlanLoc & strPropertyName & ".*"
' determine if a site plan exist
strFileName = dir(strFullFileName) ' returns only file name
If strFileName > "" Then ' it will be 0 is no file exist
' then attach the file to the email
olMailItem.Attachments.Add strFullFileName
End If
End If