Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / January 2006

Tip: Looking for answers? Try searching our database.

Send email message from Access

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
norhaya - 06 Jan 2006 03:56 GMT
Hi

My code below is an event procedure when I double click from a field (JPL1 -
"strjpl1") in a form and it will retrieve only data from current data. what i
need is your advise or show me sample code should i have more than 1 data
i.e. "PN" (strpn). anyone there can help me. i have no programming background
but I read alot and gather info from website. however i tried to get this
moving for a while now. so now i try on this website.....hope someone can
assist me

Private Sub JPL1_DblClick(Cancel As Integer)
   Dim stWhere As String       '-- Criteria for DLookup
   Dim varTo As Variant        '-- Address for SendObject
   Dim varbcc As Variant       '-- bcc address for sendobject
   Dim stText, stText1, stText2 As String        '-- E-mail text
   Dim RecDate As Variant      '-- Rec date for e-mail text
   Dim stSubject As String     '-- Subject line of e-mail
   Dim stTicketID As String    '-- The ticket ID from form
   Dim stWho As String         '-- Reference to tblUsers
   Dim stHelpDesk As String    '-- Person who assigned ticket
   Dim STCPO As String         '-- Customer PO from form
   Dim stjpo As String         '-- Janco PO from form
   Dim stjpl1 As String        '-- Janco PO from form
   Dim stKEYACCOUNTHOLDER As String     '-- Key account holder
   Dim stpn, stdesription, stsn As String
   Dim sttypeofcert As String
   Dim stmatcertno As String
   Dim stawb As String
   Dim stshipqty1 As Integer
   Dim stfltno1 As String
   Dim stshipfltdate1 As String
   Dim strSQL As String        '-- Create SQL update statement
   Dim errLoop As Error

   '-- Combo of names to assign ticket to
   stWho = Format(Me.BUYER)
   varTo = Format(Me.emailadd)
   varcc = IIf(Format(Me.SG_SALES) = "AJAY", "ajay.mehta@jancogroup.com",
IIf(Format(Me.SG_SALES) = "ALVIN", "alvin.chew@jancogroup.com",
IIf(Format(Me.SG_SALES) = "JOE", "joe.chia@jancogroup.com",
IIf(Format(Me.SG_SALES) = "ERIC", "eric.loi@jancogroup.com", ""))))
   varbcc = "admin" & ";" & "management"
   STCPO = Format(Me.C_PO_NO)
   stjpo = Format(Me.J_PO_NO)
   stjpl1 = Format(Me.JPL1)
   stKEYACCOUNTHOLDER = Format(Me.KEY_ACCOUNT_HOLDER)
   stpn = Format(Me.PN)
   stdescription = Format(Me.DESCRIPTION)
   stsn = Format(Me.SN)
   sttypeofcert = Format(Me.[TYPE OF CERTS])
   stmatcertno = Format(Me.MATERIAL_CERT_NO)
   stawb = Format(Me.AWB1)
   stshipqty1 = Format(Me.SHIP_QTY1)
   stfltno1 = Format(Me.FLT_NO1)
   stshipfltdate1 = Format(Me.SHIP_FLT_DATE1)
 
   
   stSubject = "Shipping Advice for your PO Ref:  " & STCPO & " / Our Ref:  
" & stjpo & " for Part # " & stpn
   stText = "Dear " & stWho & "," & Chr$(13) & Chr$(13) & Chr$(13) & _
            "This is to advise shipping details for following Purchase
Order; " & Chr$(13) & Chr$(13) & _
            "Your PO #:  " & STCPO & Chr$(13) & _
            "Our Ref. :  " & stjpo & Chr$(13) & _
            "Part #   :  " & stpn & "  Qty " & stshipqty1 & Chr$(13) & _
            "Serial # :  " & stsn & Chr$(13) & _
            "Mat. Cert:  " & sttypeofcert & "." & stmatcertno & Chr$(13) &
Chr$(13) & _
            "Our PL # :  " & stjpl1 & Chr$(13) & _
            "HAWB/MAWB:  " & stawb & Chr$(13) & _
            "Flight # :  " & stfltno1 & Chr$(13) & _
            "Date Ship:  " & Format([stshipfltdate1], "medium date") &
Chr$(13) & Chr$(13) & Chr$(13) & _
            "Best regards " & Chr$(13) & _
            stKEYACCOUNTHOLDER & Chr$(13) & Chr$(13) & _
            "JANCO Aviation Pte Ltd" & Chr$(13) & _
            "10 Anson Road" & Chr$(13) & _
            "#24-07 International Plaza" & Chr$(13) & _
            "Singapore 079903" & Chr$(13) & _
            "Tel: +65 63243248" & IIf(stKEYACCOUNTHOLDER = "norhaya", " x
229", IIf(stKEYACCOUNTHOLDER = "Tammy", " x 213", IIf(stKEYACCOUNTHOLDER =
"mark", " x 230", IIf(stKEYACCOUNTHOLDER = "sally", " x 210",
IIf(stKEYACCOUNTHOLDER = "jennifer", " x 211", IIf(stKEYACCOUNTHOLDER = "ting
bee", " x 228", "")))))) & Chr$(13) & _
            "Fax: +65 63243249" & Chr$(13) & _
            "email: " & IIf(stKEYACCOUNTHOLDER = "norhaya",
"norhaya.saibi", IIf(stKEYACCOUNTHOLDER = "tammy", "tammy.tan",
IIf(stKEYACCOUNTHOLDER = "mark", "mark.oh", IIf(stKEYACCOUNTHOLDER = "sally",
"sally.chia", IIf(stKEYACCOUNTHOLDER = "jennifer", "jenniferliew",
IIf(stKEYACCOUNTHOLDER = "ting bee", "kwa.tingbee", "")))))) &
"@jancogroup.com" & Chr$(13) & Chr$(13) & _
            "For sales enquiries or critical requirement after office
hours/on weekends/public" & Chr$(13) & _
            "holidays, please contact us at mobile tel # +65 9796-6435;
email: enquiry@jancogroup.com" & Chr$(13) & _
            "This is an automated message. Please do not respond to this
e-mail."

   'Write the e-mail content for sending to assignee
    DoCmd.SendObject , , acFormatTXT, varTo, varcc, varbcc, stSubject,
stText, -1

End Sub
freakazeud - 06 Jan 2006 13:36 GMT
hi,
have a look at this website:
http://www.granite.ab.ca/access/email.htm
You will find sample code which illustrates how to loop through a recordset
and send e-mails.
This should get you started.
HTH
Good luck
Signature

Oliver
Admin Specialist & Computer Science Major @ UMD - Go Terps - :)

> Hi
>
[quoted text clipped - 99 lines]
>
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.