Hi,
In the procedure Text1_KeyPress below, how can I EXIT SUB
if Text1.text is not valid ?
Thank you !
Private Sub Text1_KeyPress(KeyAscii As Integer)
Text1_Validate(True)
' Exit Sub if Variable Cancel is True
if MSFlexGrid1.Col = Num_of_Col Then
MSFlexGrid1.Row = MSFlexGrid1.Row + 1
MSFlexGrid1.Col = 0
else
MSFlexGrid1.Col = MSFlexGrid1.Col + 1
end if
Text1.Left = MSFlexGrid1.Left + MSFlexGrid1.ColPos(c)
Text1.Top = MSFlexGrid1.Top + MSFlexGrid1.RowPos(r)
End Sub
Private Sub Text1_Validate(Cancel As Boolean)
...open recordset
If rs1.EOF() Then
Cancel = False
Else
MsgBox "Code Duplicated !", vbExclamation + vbOKOnly, "Error"
Cancel = True
End If
rs1.Close
Set rs1 = Nothing
End Sub