Results 1 to 10 of 10
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Web link in code (2002 SP-2)

    1. I don't think it is possible to create a hyperlink in the message body using SendObject.

    2. The error that occurs is Error 2501 - action cancelled by user. You can avoid it by adding error handling to the procedure:

    Private Sub cmdEmailLoadsAvailable_Click()
    On Error GoTo ErrHandler
    ...
    ...
    DoCmd.SendObject ...
    Exit Sub

    ErrHandler:
    If Err.Number = 2501 Then
    ' E-mail cancelled - just ignore the error
    Else
    ' Other error - inform user
    MsgBox Err.Description, vbExclamation
    End If
    End Sub

  2. #2
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: Web link in code (2002 SP-2)

    Hans:

    Thanks for the reply. I suppose I can just instruct the recipient to copy/paste to their browser.
    Is there something in this particular code that prevents VBA from diplaying a "default" error handling? It used to do that any time I opened the code window from a new event procedure? For whatever reason, it's not doing that any more. Thank you for the "manual" code entry.

    (Did you notice I actually learned a little something from our last discussion?)
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

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

    Re: Web link in code (2002 SP-2)

    I noticed that you were able to expand the message. I also saw your other post about error handling. I don't know what causes your problem, but let's keep that discussion in its own thread.

  4. #4
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: Web link in code (2002 SP-2)

    Hans:

    Thanks for your help with the error handling, it works perfectly (of course).
    I'll keep my fingers cross for help with the other issue.
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  5. #5
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: Web link in code (2002 SP-2)

    Hans (and anyone else following):

    I discovered that the link will not display in HTML, but will in plain or rich text!

    Now, however, when I cancel the e-mail it is returning a "You can't exit . . .If you're running a Visual Basic module that is using OLE or DDE, you may need to interupt the module". When I click "OK" I get the following popup and then the form loses focus and I can't exit (need Task Manager):

    EDIT: I don't know that it matters, but I just recalled that there is an "On Timer" event associated with this form. Might that be the cause? I don't have a clue why it all worked before I changed the Outlook message view from HTML to plain/rich text and then back again. The "On Timer" event code is:

    Private Sub Form_Timer()
    Dim lngCount As Long
    lngCount = DCount("*", "tblMaster", "OrderStatus='NEW'")
    If lngCount > 0 Then
    Searching.Caption = "New order(s) found: " & lngCount
    Searching.BackStyle = 1 ' Normal
    Else
    Searching.Caption = " "
    Searching.BackStyle = 0 ' Transparent
    End If
    Me.Requery
    End Sub
    Attached Images Attached Images
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

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

    Re: Web link in code (2002 SP-2)

    The error message dialog in your screenshot is the standard, built-in Access error message. That means the error handling is not working. Has it disappeared?

  7. #7
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: Web link in code (2002 SP-2)

    Hans:

    It's all still there, and I looked it over again. I don't see where I might have "bumped" anything after it worked the first time.
    Here's what I (as of this very moment) have entered:

    Private Sub CmdEmailLoadsAvailable_Click()
    On Error GoTo ErrHandler
    'Email rptLoadsAvailable to AAACarriersAll

    Dim strReportName As String
    Dim strRecipient As String
    Dim strSubject As String
    Dim strMessage As String
    Dim blnEditMail As Boolean

    strReportName = "rptLoadsAvailable"
    strRecipient = "AAACarriersAll"
    strSubject = "Available Loads"
    strMessage = "The attached Available Loads Report lists loads that are CURRENTLY" _
    & vbCrLf & "available as of this date and time. The report can only be read with MicroSoft's" _
    & vbCrLf & "Snapshot Viewer which is free on the WWW at http://www.microsoft.com/accessdev/p.../snapshot.htm" _
    & vbCrLf & vbCrLf & "Regards," & vbCrLf & "Bryan"
    blnEditMail = True

    DoCmd.SendObject acSendReport, strReportName, acFormatSNP, strRecipient, , , strSubject, strMessage, blnEditMail
    Exit Sub

    ErrHandler:
    If Err.Number = 2501 Then
    'E-mail cancelled - just ignore the error
    Else
    'Other error - inform user
    MsgBox Err.Description, vbExclamation
    End If
    End Sub
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  8. #8
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Web link in code (2002 SP-2)

    I would like to have the following (EDITpicture deleted, not pertinent) http appear in the email body as a link (it currently only appears as text). Also, if I cancel the send, I get a runtime error in the last line of code (and there is no error handling). Any help/input appreciated.
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

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

    Re: Web link in code (2002 SP-2)

    In that case: are you sure that you are invoking this code? Perhaps you have other code that calls DoCmd.SendObject, without error handling? If not, I am stumped.

  10. #10
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: Web link in code (2002 SP-2)

    Hans:

    Being mutually stumped, I copied the code and deleted it as well as the cmdbtn. I placed a new cmdbtn on the form and pasted the code in.
    It works just fine now! <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>
    I just vaguely recall a similar case when I re-named a command button several months ago, but that wasn't what happened here. Oh well, all is well at present.

    I don't want to get too sentimental here, but you have always been most gracious, patient, and certainly generous with your code and over-all knowlege. It's so easy to just take that for granted. However, I am always most grateful for it even if I don't put it in the thread. You have saved my tail on more than one occasion. I may not always retain what you have taught me - but I do try.

    If I ever get to Leiden I'd love to tip one with you! <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    (I'm a Guiness & Jameson man myself)
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

Posting Permissions

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