G
Guest
Hi all,
I have a form that a user has to input values into. The form consists of
about 30 pairs of text boxes, in the following format
TxtA1 txtA2
TxtB1 txtB2
Etc.
Now, when the user enters something into txtA1, the value(an integer) must
be smaller than the value entered into txtA2. For example, txtA1 is “Age
minimum†and txtA2 is “Age maximumâ€
I have a validation function to check that the entered data makes sense, but
when I have a blank pair of text boxes, I get a “type incompatible†run-time
error.
I used the following code to check:
If Nz(CInt(Me.txtA1)) > Nz(CInt(Me.txtA2)) Then
MsgBox "Der Maximum in the range for Age Groups must be greater than the
minimum.", vbOKOnly + vbExclamation, "Error"
ValidateRanges = False
End If
What is wrong here? If I swap Nz and Cint, the same happens
(i.e. If CInt(Nz(Me.txtA1)) > CInt(Nz(Me.txtA2)) Then …)
Regards,
Jean
I have a form that a user has to input values into. The form consists of
about 30 pairs of text boxes, in the following format
TxtA1 txtA2
TxtB1 txtB2
Etc.
Now, when the user enters something into txtA1, the value(an integer) must
be smaller than the value entered into txtA2. For example, txtA1 is “Age
minimum†and txtA2 is “Age maximumâ€
I have a validation function to check that the entered data makes sense, but
when I have a blank pair of text boxes, I get a “type incompatible†run-time
error.
I used the following code to check:
If Nz(CInt(Me.txtA1)) > Nz(CInt(Me.txtA2)) Then
MsgBox "Der Maximum in the range for Age Groups must be greater than the
minimum.", vbOKOnly + vbExclamation, "Error"
ValidateRanges = False
End If
What is wrong here? If I swap Nz and Cint, the same happens
(i.e. If CInt(Nz(Me.txtA1)) > CInt(Nz(Me.txtA2)) Then …)
Regards,
Jean