Assuming you're talking about the code in
http://www.mvps.org/access/modules/mdl0019.htm, you could either use the
DLookup function to get the attachment name, as in replacing
MAPIAddAttachment stFile:="C:\config.sys"
with
Dim varFile As Variant
varFile = DLookup("[FileName]", "[MyTable]", "User =
'dash10@hotmail.com'")
If IsNull(varFile) = False Then
MAPIAddAttachment stFile:=varFile
End If
or you could open a recordset that returns the details of what you want to
send to whom, and loop through that recordset. The basic approach to using a
recordset is:
Dim rsCurr As DAO.Recordset
Dim strSQL As String
Dim clMAPI As clsMAPI
Set clMAPI = New clsMAPIEmail
strSQL = "SELECT EMailAddress, FileName FROM MyTable"
Set rsCurr = CurrentDb.OpenRecordset(strSQL)
Do Until rsCurr.EOF
With clMAPI
.MAPILogon
.MAPIAddMessage
.MAPISetMessageBody = "Test Message"
.MAPISetMessageSubject = "Some Test"
.MAPIAddRecipient stPerson:=rsCurr!EmailAddress, _
intAddressType:=1
.MAPIAddAttachment stFile:=rsCurr!FileName
.MAPIUpdateMessage
.MAPISendMessage boolSaveCopy:=False
.MAPILogoff
End With
rsCurr.MoveNext
Loop
rsCurr.Close
Set rsCurr = Nothing

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> Hi
>
[quoted text clipped - 7 lines]
>
> Wendy