Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2004
    Posts
    17

    Unanswered: VBS: Is there a Cancel Action Command

    I have two actions running on the click of a button 1) when pressed 2) when released.
    Is there a command or piece of code I can enter into the first so that If conditions arent met I can cancel the second action.

    I know I can do .Stop() but this deactivates my whole program and I would prefer just a message box to come up and the user is ready to enter info again.

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346
    Make a flag variable in your first function that sets to true if your condition is met and false if not met. In the second function check the value of the flag and either run your code or display the message box. i.e.

    Code:
    Private blnFlag as Boolean
    
    Private Sub Function1()
    
    If Condition = True Then
         blnFlag = True
    Else
         blnFlag = False
    End If
    
    End Sub
    
    Private Sub Function2()
    
    If blnFlag = True Then
         'Run your code
    Else
         MsgBox "Conditions not met."
    End If
    
    End Sub
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

Posting Permissions

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