Results 1 to 2 of 2
  1. #1
    Ultimateneo is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    19

    populating emails using on click event of hyperlink

    Hello,



    I am having a problem with populating my email using a hyperlink field on a form.

    I have a main form and a sub form, in the sub form there are the fields First Name Last name and email address (This is a hyperlink)

    If i click on it, an email opens up with that email in the to field. I would like to add a signature based on the person i am emailing. As i have a html signature and a plain signature.

    If i put code on the on click event it will open 2 emails, one form the hyperlink and one from the click running the code is it possible to just have the email generated once? i think i don't need to create the mail item for example

    Code:
    
    Private Sub CurrentEmail_Click()
    Dim oApp As Outlook.Application
    'Dim oMail As MailItem
    Set oApp = CreateObject("Outlook.application")
    
    
    'Set oMail = oApp.CreateItem(olMailItem)
    oMail.Body = "Body of the email"
    oMail.Subject = "Test Subject"
    oMail.To = Me.Currentemail
    oMail.display
    Set oMail = Nothing
    Set oApp = Nothing
    End Sub
    Thank you for any help much appreciated

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    I would think that the preferred method would be to use the email code and forget the hyperlink altogether as the hyperlink method may (if not now, then in the future) cause Access to raise dialogs that you don't want (e.g. security messages, 'which application do you want to open this with' etc). However, just this will work but for me, raises the application prompt

    application.FollowHyperlink "mailto:addressHere@someplace.com"
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. populating address of hyperlink with VBA
    By ClassicVinyl in forum Programming
    Replies: 11
    Last Post: 08-02-2018, 04:57 PM
  2. Replies: 7
    Last Post: 08-22-2013, 05:24 PM
  3. emails from Access making the emailid hyperlink work
    By techexpressinc in forum Programming
    Replies: 3
    Last Post: 08-30-2011, 06:56 AM
  4. Allow right-click on Hyperlink to edit?
    By ThomasH in forum Access
    Replies: 3
    Last Post: 05-26-2011, 06:38 AM
  5. Populating emails with database info
    By daviddixon in forum Import/Export Data
    Replies: 9
    Last Post: 08-23-2010, 08:42 AM

Tags for this Thread

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