Check that you have completed all fields on the form with numeric checks and empty checks.
Check that you have completed all fields on the form with numeric checks and empty checks.
API Declarations
'and n for numeric field
' call it in the update procedure
' if function returns True then update else
' it automatically select the faulty field
Rate Check that you have completed all fields on the form with numeric checks and empty checks.
(2(2 Vote))
dim ctl as Control
For Each ctl in Controls
If TypeOf ctl is TextBox then
Select Case ctl.Tag
Case "r"
If Len(Trim(Ctl.Text))=0 then
MsgBox ctl.DataField & " Can not be empty Click OK to Have Focused it."
ctl.SetFocus
SenKeys "^{HOME}+^{END}",True
Exit Function
End If
Case "n"
If Not IsNumeric(ctl.Text) then
MsgBox ctl.DataField & " Can not be Non Numeric Click OK to Have Focused it."
ctl.SetFocus
SenKeys "^{HOME}+^{END}",True
Exit Function
End If
Case "+"
If Not (IsNumeric(Ctl.Text) AND Val(ctl.Text)>0) then
MsgBox ctl.DataField & " Must be Numeric and Positive, Click OK to Have Focused it."
ctl.SetFocus
SenKeys "^{HOME}+^{END}",True
Exit Function
End If
End Select
End If
Next
ValidationIsOk=True
End Function
'Call it like
Sub cmdUpdate_Click()
'e.g
If ValidationIsOk then
'Update my record
Else
'Problem statement is automatically from 'ValidationIsOk Function'
End if
End Sub
Check that you have completed all fields on the form with numeric checks and empty checks. Comments
No comments yet — be the first to post one!
Post a Comment