Results 1 to 6 of 6
  1. #1
    jhargram is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2012
    Posts
    40

    Send mail from ms access (body should fetch from access textbox"in form")

    Hi all,
    I am new in Access and I am trying to do some project.
    Actually I have a form and in that form I have some textbox with some data and have one commend button. If i click that button then it will open outlook mailbox and in body I need to pull all the data what i have in textbox.


    Please guide me to solve this issue. Thanks in advance.

    biplab

  2. #2
    redbull's Avatar
    redbull is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2012
    Location
    Missouri
    Posts
    480
    Easy enough

    Okay, basically ignore this first bit of code. This generates an email based on what information is availabe in IE...

    Code:
     Sub CreateHTMLMail()
            ''''Creates a new e-mail item and modifies its properties'
    
    
        Dim olApp As Outlook.Application
        Dim objMail As Outlook.MailItem
        Set olApp = Outlook.Application
        'Create e-mail item'
        Set objMail = olApp.CreateItem(olMailItem)
        Dim oServMan As InternetExplorer
        Dim Client, aClient, ClientNum, ProbLoc, SMmail, Sum, Desc, SD As String
        Dim iQLS As Long
       
        Set oServMan = GetServMan
        Set otest = New clsSmselect
    
    
        otest.SMselect oServMan
     
        Set oServMan = GetServMan
      
            Client = otest.Client
            ProbLoc = otest.ProbLoc
            SMmail = otest.SMmail
            Sum = otest.Sum
            Desc = otest.Desc
            SD = otest.SD
     
        Set oServMan = Nothing
              ''' Assigning things above in outlook mail message.
          With objMail
            .Subject = Client & " / " & Sum & " / " & SD
            .Body = "Ticket Notes: " & Desc
            .To = SMmail
            .Display
            .ReadReceiptRequested = True
          End With
      End Sub

    Okay, so seeing what that did above lets fit it for your use...


    Code:
    Sub CreateHTMLMail()
            ''''Creates a new e-mail item and modifies its properties'
    
    
        Dim olApp As Outlook.Application
        Dim objMail As Outlook.MailItem
        Set olApp = Outlook.Application
        'Create e-mail item'
        Set objMail = olApp.CreateItem(olMailItem)
    
              ''' Assigning things in the outlook mail message.
          With objMail
            .Subject = Forms("Formname").txtboxname
            .Body = Forms("Formname").txtboxname
            .To = Forms("Formname").txtboxname
            .Display
            .ReadReceiptRequested = True  'IF you want to enforce a read receipt, keep this part, if not just comment or remove it
          End With
      End Sub
    Now, IF IF IF you were to post your form names and text boxes you want to pull from I could assist further. BUT I hope that points you in the right direction.

  3. #3
    redbull's Avatar
    redbull is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2012
    Location
    Missouri
    Posts
    480
    Safe to assume this worked?

  4. #4
    jhargram is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2012
    Posts
    40
    Thank you redbull. It helps me a lot...

  5. #5
    nickblitz is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    21
    how do i edit the code above to extract all the emails from a datasheet with a click of a button? it should open up an outlook new email.

  6. #6
    redbull's Avatar
    redbull is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2012
    Location
    Missouri
    Posts
    480
    Without knowing much about it... can you post a copy of your DB without the sensitive info? Or explain with greater detail. The first thing that comes to mind is a regex statement, but without specifics.... hard to say

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 06-28-2012, 02:05 PM
  2. Replies: 1
    Last Post: 04-05-2012, 08:26 AM
  3. Replies: 2
    Last Post: 11-04-2011, 02:45 AM
  4. Using ListBox value as "Body of outlook task"
    By AccessFreak in forum Database Design
    Replies: 3
    Last Post: 05-07-2011, 04:40 PM
  5. Unhide a form in the Access "Explorer"
    By caddcop in forum Forms
    Replies: 1
    Last Post: 02-15-2011, 01:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums