Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending Email with Attachments

Status
Not open for further replies.

lshields

Technical User
Nov 16, 2003
20
US
I have a form that I use send email through access 2k. I want to be able to add attachments to these emails but when I input the filename in to a textbox for attachments an error is generated when I try to send it.

My code looks like this:

with eml
.bcc = adrslist
.subject = txtSubject
.attachments = txtAttach
.body = txtMessage
.send
end with

In the txtAttach field I do have the full path of the file. I'm not to sure how the attachment function works but can someone help me out here?

Thanks
 
.Attachments.Add txtAttach

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Is there a way that my text box can hold multiple filenames and then use the same command to add them to the email?
 
For Each txtItem In Split(txtAttach)
.Attachments.Add txtItem
Next

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
This is working except I am using a ; to seperate filenames. If I run this code as is I end up with a blank path for the last file which causes the whole thing to bomb out. How can I get rid of the last ; in the text box?
 
For Each txtItem In Split(txtAttach,";")
strItem = strItem & txtItem
Next

strItem = Left(strItem,Len(strItem) - 1)


.Attachments.Add strItem

I think I'm missing something, about your procedure?
The split function, should be removing the semicolons?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top