Results 1 to 8 of 8
  1. #1
    Lounger
    Join Date
    Jul 2005
    Location
    Lancaster, Delaware, USA
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Auto Email (Access 2000/ windows xp)

    Hello,
    I would like to know if it is possible to have an email sent everytime a record is logged into a table. For example I have a table called shipping and handling(tblShippingHandling), now when a user enters a record in the table using a form (frmShippingHandling) i would like an email notification to be sent to the person requesting the items, essentially letting them know that the components are in house. I also have a table called tblEmployees that has all of the logon info, email addresses, etc. Is this possible? Any help will be very much appreciated.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Auto Email (Access 2000/ windows xp)

    You could write code for the After Insert event of the form:

    Private Sub Form_AfterInsert()
    Dim strRecipient As String
    Dim strSubject As String
    Dim strMessage As String

    strRecipient = ... ' determine addressee
    strSubject = ... ' subject of the e-mail
    strMessage = ... ' body text

    DoCmd.SendObject To:=strRecipient, Subject:=strSubject, _
    MessageText:=strMessage, EditMessage:=False
    End Sub

    You can use concatenation with & and line breaks with vbNewLine to send a multi-line message, for example:

    strMessage = "Your order was processed on " & Date & vbNewLine & vbNewLine & _
    "Yours sincerely," & vbNewLine & "Mickey"

  3. #3
    Lounger
    Join Date
    Jul 2005
    Location
    Lancaster, Delaware, USA
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto Email (Access 2000/ windows xp)

    Hans,
    Thanks alot I will try the suggestions

  4. #4
    Lounger
    Join Date
    Jul 2005
    Location
    Lancaster, Delaware, USA
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto Email (Access 2000/ windows xp)

    Hans,
    I appreciate the assistance your suggestions worked flawlessly. I was wondering is there anyway to change the format of the message being sent. Can I change the font, font size, font color, etc. Any suggestions would be very much appreciated.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Auto Email (Access 2000/ windows xp)

    DoCmd.SendObject is intended to work with whatever the user's default mail program is, so it doesn't support formatting (the mail program might use only plain text).

    If you have Outlook and if you really need formatting, you could use Automation to create a formatted HTML message in Outlook from Access, but it's a lot more work.
    See WendellB

  6. #6
    Lounger
    Join Date
    Jul 2005
    Location
    Lancaster, Delaware, USA
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto Email (Access 2000/ windows xp)

    Hello,
    I have a hyperlink stored in one of the fields in the table. I was wondering if there is anyway to have this hyperlink sent in the email. Right now i get the path like this #path# in the email. Is there anyway to have this in a hyperlink format without alot of code. Not that im afraid of a little code it would just be nice to have this working pretty soon. Does it look like I should use automation instead of the SendObject Method? And just for my own knowledge; why does the format of the hyperlink change to the above format of #path#? Any help is as always very much appreciated.

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Auto Email (Access 2000/ windows xp)

    Access stores hyperlinks in the form of a memo (long text) field with three sections separated by # characters:

    display text#hyperlink address#subaddress

    If the 'display text' part is empty, the 'hyperlink address' part is used as display text. The 'subaddress' part is only filled if needed. You could remove the # characters from the text (using the Replace function) and see if the hyperlink address gets converted. Otherwise, you'll need Automation.

  8. #8
    Lounger
    Join Date
    Jul 2005
    Location
    Lancaster, Delaware, USA
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto Email (Access 2000/ windows xp)

    Thanks Hans I will try your suggestion out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •