473,651 Members | 2,630 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sending E-mails with Outlook from A2002

Hello!

I'm sending E-mails to mailadresses in a table, using the code below.
How can I send more than one attachment?
Access can find the file to be send in this field: MY_EMAILATTACHM ENT_FIELD
I have also a field with the name MY_EMAILATTACHM ENT_FIELD2
Combining the field names with an &-sign doesn't work, even when I put a ;
in between.
Thanks for a helping hand!

Dirk
= = = = = = WORKING CODE FOR A SINGLE ATTACHTMENT = = = = = = = =
Private Sub ButtonMakingMai ls_Click()

On Error GoTo LABEL1

Dim evFile As String

Dim Response As Byte

Dim rs As Recordset

Dim olApp As Outlook.Applica tion, olItem As Outlook.MailIte m

Set olApp = New Outlook.Applica tion

Set rs = CurrentDb.OpenR ecordset("selec t * from MYTABLE where
([MY_E-MAIL_FIELD] Is Not Null)")

Response = MsgBox("Start sending E-Mails via Outlook?", vbYesNo)

If Response = vbNo Then Exit Sub

Do Until rs.EOF

Set olItem = olApp.CreateIte m(olMailItem)

olItem.To = rs("MY_E-MAIL_FIELD")

olItem.Subject = Me.MY_EMAILSUBJ ECT_FIELD

olItem.Body = Me.MY_EMAILBODY _FIELD

If Me.My_EMAILATTA CHMENT_FIELD = "" Then

Else

evFile = Me.MY_EMAILATTA CHMENT_FIELD

' Here, two invalid lines - Error message: Invalid file or path name

' evFile = Me.MY_EMAILATTA CHMENT_FIELD & "; " &
Me.MY_EMAILATTA CHMENT_FIELD2

' evFile = Me.MY_EMAILATTA CHMENT_FIELD & " " &
Me.MY_EMAILATTA CHMENT_FIELD2
' End of the not working part

olItem.Attachme nts.Add evFile

End If

If Me.MY_AUTOSEND_ FIELD = -1 Then

olItem.Send

Set olItem = Nothing

Else

olItem.Display

Set olItem = Nothing

Response = MsgBox("Next email?", vbYesNo)

If Response = vbNo Then

rs.Close

Exit Sub

End If

End If

rs.MoveNext

Loop

rs.Close

Set rs = Nothing

Set olApp = Nothing

LABEL2:

Exit Sub

LABEL1:

MsgBox Err.Description

Resume LABEL2:

End Sub
Jun 9 '06 #1
1 1632
Use a separate .Add line for each file.
Jun 9 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
14515
by: coder_1024 | last post by:
I'm trying to send a packet of binary data to a UDP server. If I send a text string, it works fine. If I attempt to send binary data, it sends a UDP packet with 0 bytes of data (just the headers). I can see this because I'm running Ethereal and watching the packets. I'm defining the packets as shown below: $text_msg = "Hello, world\r\n"; $binary_msg = chr(0x01).chr(0x02).chr(0x03).chr(0x00).chr(0xA0); $binary_msg_size = 5;
0
522
by: praba kar | last post by:
Dear All, I have doubt regarding mail sending smtplib module. The below code is I used to send a mail. ########################################## import email.Message import email.Utils import mimetypes import os,string
3
4626
by: Robert A. van Ginkel | last post by:
Hello Fellow Developer, I use the System.Net.Sockets to send/receive data (no tcpclient/tcplistener), I made a receivethread in my wrapper, the receivethread loops/sleeps while waiting for data and then fires a datareceived event. Within the waitingloop there is a timeout function, but I want the the 'last-time-socket-used' variable set when the socket is finished sending. When I send by System.Net.Sockets.Socket.Send(buffer()) (<--this...
4
8197
by: yaron | last post by:
Hi, I have a problem when sending data over TCP socket from c# client to java server. the connection established ok, but i can't send data from c# client to java server. it's work ok with TcpClient, NetworkStream and StreamWriter classes. but with low level socket it doesn't work (When using the Socket class Send method).
3
3610
by: Ant | last post by:
Hi, I'm using the MailMessage & smtpMail classes in System.Web.Mail to send mail, however it's not sending any emails. I'm using it on a Windows 2003 server. The simplest way to use this is smtpMail.Send("from@here.com", to@there.com, "Message subject", "Message Body") I'm sending it to my own email address on a different server using a dummy
3
7719
by: Sydney | last post by:
Hi, I am trying to construct a WSE 2.0 security SOAP request in VBScript on an HTML page to send off to a webservice. I think I've almost got it but I'm having an issue generating the nonce value for the UserName token. Is it possilbe at all to do this from VBScript (or jscript?)? I know I will be limited with what I can do with the SOAP message. Eg/ can't sign/encrypt it etc. Thanks,
3
11328
by: Sells, Fred | last post by:
I'm using MSW XP Pro with Python 2.4 to develop but production will be Linux with Python 2.3. (could upgrade to 2.4 if absolutely necessary) I can also switch to Linux for development if necessary. I am writing some python to replace proprietary software that talks to a timeclock via UDP. The timeclock extracts the sending port from the UDP header and uses that for all response messages.
0
1855
by: remya1000 | last post by:
by using FTP i can send files to server using vb.net. if the file is big, then it will take some time to complete the sending process to server.or if we were sending 3-4 files to the server one by one,then whethere we can show the progress of each file sending to server in progress bar. so that the FTP clients can see the progress of file sending to the server. any idea how we can do this to show the progress of each file sending. if we...
9
3453
by: JoeP | last post by:
Hi All, How can I find the reason for such an error: Failure sending mail. Some Code... oMailMessage.IsBodyHtml = False oMailMessage.Body = cEmailBody Dim oSMTP As New SmtpClient oSMTP.Send(oMailMessage) (in this line I am getting the above err)
4
2394
by: =?Utf-8?B?R3V5IENvaGVu?= | last post by:
Hi all I use: Dim message As New MailMessage(txtTo.Text, txtFrom.Text, txtSubject.Text, txtBody.Text) Dim emailClient As New SmtpClient(txtSMTPServer.Text) emailClient.Send(message) And its working fine. However I was wondering if there is a way to confirm that the email was sent. The send method does not return anything....
0
8349
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8695
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8460
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7296
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6157
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4281
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1906
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.