Results 1 to 4 of 4

Thread: sub not defined

  1. #1
    Join Date
    Aug 2012
    Posts
    126

    Unanswered: sub not defined

    Added Error handling to my code and it tells me private sub not define. Anyone know why?

    Private Sub cmdSalesForcePrint_Click()
    On Error GoTo Err_cmdSalesForcePrint_Click

    DoCmd.OpenReport "rptInventoryreductionForSalesForce", acViewReport, "", "", acNormal
    DoCmd****nCommand acCmdPrint
    DoCmd.Close acReport, "rptInventoryReductionForSalesForce"

    Exit_cmdSalesForcePrint_Click
    Exit Sub
    Err_cmdSalesForcePrint_Click
    MsgBox Err.Description
    Resume Exit_cmdSalesForcePrint_Click

    End Sub

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    You need Colons after your Error and Exit subs:

    Exit_cmdSalesForcePrint_Click:
    Exit Sub
    Err_cmdSalesForcePrint_Click:
    MsgBox Err.Description
    Resume Exit_cmdSalesForcePrint_Click

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Aug 2012
    Posts
    126
    I owe you a beer!


  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Glad we could help!

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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