Sound's like you're using the native email function in access, is this correct? The Access function only allows you to attach one file through the code. Here's a solution I found online yesterday:
Code:
Public Function MailTo(ByVal ExportPath As String) As BooleanDim OutlookApp As Object
Dim EM As Object
On Error GoTo ErrorHandler:
Set OutlookApp = GetObject(, "Outlook.Application")
OutlookApp.GetNamespace("MAPI").Logon
Set EM = OutlookApp.CreateItem(0)
With EM
.To = "you@you.com"
.Subject = "Data submission for " & Get_Global("program_name")
.Body = "Thank you!" & vbCrLf & vbCrLf & Get_Global("program_name")
.Attachments.Add ExportPath
.Send
End With
MailTo = True
Set OutlookApp = Nothing
Set EM = Nothing
Exit Function
ErrorHandler:
'if outlook is closed, open it
If Err.Number = 429 Then
Set OutlookApp = CreateObject("Outlook.Application")
Resume Next
End If
If Not Err.Number = 287 Then
MsgBox "Error Number: " & Err.Number & " " & Err.Description
End If
Set OutlookApp = Nothing
Set EM = Nothing
End Function
Using that you can add as many attachments as you want with .attachments.add method.
To search though files in a directory use this guide: http://allenbrowne.com/func-11.html
Loop through the names of all of the files somehow and then compare each name as you stated before: "c:\SP\" like "'*" & me.spName &"*'"
I'd recommend using instr() instead of a like statement, my preference