hawaiian1975
Programmer
I am trying to show pass data to another form once the data is validated. My problem is that when I click the next form selection, it will validate the data and still move on to the next form. For example, I type in 23A6, it will validate the data as invalid and still move on to the next form. Here is the code that I am trying:
Private Sub mnuDataNextForm_Click()
Const conBtns = vbOK + vbExclamation + vbDefaultButton1 + vbApplicationModal
Dim Ndx As Integer
Dim Cancel As Boolean
For Ndx = txtWheel.LBound To txtWheel.UBound
txtWheel_Validate Ndx, Cancel
If Cancel Then
MsgBox "Invalid Data", conBtns, "Data Entry Form"
txtWheel(Ndx).SetFocus
Else
frmCompute.Show
frmDataEntry.Hide
Exit For
End If
Next Ndx
End Sub
Private Sub mnuDataNextForm_Click()
Const conBtns = vbOK + vbExclamation + vbDefaultButton1 + vbApplicationModal
Dim Ndx As Integer
Dim Cancel As Boolean
For Ndx = txtWheel.LBound To txtWheel.UBound
txtWheel_Validate Ndx, Cancel
If Cancel Then
MsgBox "Invalid Data", conBtns, "Data Entry Form"
txtWheel(Ndx).SetFocus
Else
frmCompute.Show
frmDataEntry.Hide
Exit For
End If
Next Ndx
End Sub