First of all, I'd recommend against using GoTo in any of your code. There's almost always a better solution than using GoTo.
2nd, you're not being specific enough. If you want to execute code based off of a certain condition, then use If/Then or Select/Case statements.
If there's just 2 or 3 conditions then If/Then is fine, if there's more then Select/Case will be better and less time consuming. ie:
vb Code:
Private Sub Form_Load() Dim intAge As Integer intAge = 50 Select Case intAge Case Is < 20 MsgBox "You're younger than 20" Case Is >= 40 MsgBox "You're over the hill" Case 42, 72, 56 MsgBox "You're either 42, 72, or 56 years old" Case 100 MsgBox "wow" End Select End Sub




Reply With Quote