antifashionpimp
Registered User.
- Local time
- Today, 16:14
- Joined
- Jun 24, 2004
- Messages
- 137
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:
What is wrong here? If I swap Nz and Cint, the same happens
(i.e.
…)
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:
Code:
If Nz(CInt(Me.txtA1)) > Nz(CInt(Me.txtA2)) Then
MsgBox "The 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.
Code:
If CInt(Nz(Me.txtA1)) > CInt(Nz(Me.txtA2)) Then
Regards,
Jean