Re: email data from form

From: Steve (sschmideler_at_perfect-product.com)
Date: 04/27/04


Date: Tue, 27 Apr 2004 15:55:35 -0500

Requires that your references include Microsoft CDO for Windows 2000 Library
and Microsoft ActiveX Objects 2.5 Library, but here it is:

' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Windows 2000 Library
Dim iConf As New CDO.Configuration
Dim Flds As ADODB.Fields
Set Flds = iConf.Fields

' Set the configuration
Flds(cdoSendUsingMethod) = cdoSendUsingPort
Flds(cdoSMTPServer) = "mail.example.com"

' ... other settings
Flds.Update

Dim iMsg As New CDO.Message
Set iMsg.Configuration = iConf

' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Windows 2000 Library
Dim iMsg As New CDO.Message

' configure message here if necessary
With iMsg
   .To = "user@domain.com"
   .From = "user@domain.com"
   .CC = user@domain.com
   .Subject = "Test"
   .TextBody = "Body of Message"
   .AddAttachment "\\server\share\file.txt"
   .Fields(cdoDispositionNotificationTo) = "user@domain.com"
   ' finish and send
   .Fields.Update
   .Send
End With
Set iMsg = Nothing

Depending on what your doing you might need to concantonate the user entries
to populate the fields. ie,
strUserInput = txtText1 & " " & TxtText2 &, etc
strUserInput2 = "Sincerely, " & txtText3
then use, for example,
.TextBody = strUserUnput & vbcrlf & strUserUnput2 & vbcrlf
Note this is just an example and I made the text info up.

"Brian C" <anonymous@discussions.microsoft.com> wrote in message
news:504201c42c97$43dd31b0$a401280a@phx.gbl...
> I have a form in which a user can type data plus an email
> address and I then want to send that data to the email as
> a message.
>
> Can I do this in ACCESS and if so how or where can I find
> an example? Thanks



Relevant Pages

  • Re: Access 2003-Access 2002 Incompatibility
    ... Microsoft ActiveX Data Objects Recordset 2.7 Library ... The first one corresponds to msado15.dll (and adds the ADODB reference), ... There are two ADO type libraries. ...
    (microsoft.public.access.conversion)
  • Re: Late Binding
    ... You can try unchecking the reference, ... need to add the Microsoft ActiveX Data Objects 2.7 Library reference back. ...
    (microsoft.public.access.queries)
  • Re: NTSVC.OCX Help needed
    ... The only things reference in the application beyond the standard ... > VB references are NTSVC.OCX, Microsoft ActiveX Data Objects 2.5 Library, ... I believe Desaware made a commercial service control. ...
    (microsoft.public.vb.general.discussion)
  • Re: Missing reference library
    ... By not checking the reference ... Microsoft ActiveX Data Objects 2.5 and this worked fine. ... Animation Carbon: Copy/Paste/Share animation libraries. ...
    (microsoft.public.powerpoint)
  • Re: Copy range from closed file
    ... > reference to ... > Microsoft ActiveX Data Objects 2.5 library ...
    (microsoft.public.excel.programming)