Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Moundridge, Kansas, USA
    Posts
    342
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Cancel a command (Access 2003 SP2)

    I have a command that prints a request form and a label. I need to be able to cancel it if there is a "No" in the cboRequestForm. I'm drawing a blank.

    Private Sub cmdPrintBRF_Click()
    On Error GoTo Err_cmdPrintBRF_Click

    Dim stDocName As String

    stDocName = "rptRequestForm"
    DoCmd.OpenReport stDocName, acNormal, , "CustomerID ='" & Me.CustomerID & "'"

    stDocName = "lblsCustomerHome"
    DoCmd.OpenReport stDocName, acViewNormal, , "CustomerID ='" & Me.CustomerID & "'"

    Exit_cmdPrintBRF_Click:
    Exit Sub

    Err_cmdPrintBRF_Click:
    MsgBox Err.Description
    Resume Exit_cmdPrintBRF_Click

    End Sub

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

    Re: Cancel a command (Access 2003 SP2)

    Insert a line

    If Me.cboRequestForm = "No" Then Exit Sub

    at the beginning of the procedure.

  3. #3
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Moundridge, Kansas, USA
    Posts
    342
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Cancel a command (Access 2003 SP2)

    Thanks, HansV. I thought it was something very simple but couldn't come up with it.

Posting Permissions

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