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

    ErrorMsg causes form to lose focus (2002 SP-2)

    In the following code, if I cancel the send in Outlook, Access returns the MsgBx attached. When I click "OK" the current form
    loses focus and I have to use Task Manager to close the application. This does not happen every time ( 2 out of 5 cancels)

    <pre>Private Sub CmdLoadsAvailable_Click()
    On Error GoTo ErrHandler
    'Email rptLoadsAvailable to AAACarriersAll (Outlook)

    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" _
    & vbCrLf & "with MicroSoft's Snapshot Viewer."
    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</pre>

    Attached Images Attached Images
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: ErrorMsg causes form to lose focus (2002 SP-2)

    What exactly is ProDispatch_6? Is that your application name? If so, then I suspect you are hitting a part of the creation of the snapshot that doesn't want to be interrupted. You might try putting a DoEvents after the DoCmd.SendObject line to allow whatever is in process to complete itself before control returns to Access.
    Charlotte

  3. #3
    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: ErrorMsg causes form to lose focus (2002 SP-2)

    Charlotte:

    Thanks for the reply. Yes, that's my app name. I haven't gotten it to repeat the error again since about 1:00PM, and I made several (15?) attempts to get it to happen; in rapid succession. That being the case, I think I will leave well enough alone until it becomes an issue again (like in the middle of business). I will know where to look now for a resolution though.
    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
  •