I want to create conditional Validation Rule

cherosoullis

Registered User.
Local time
Today, 21:41
Joined
Jun 23, 2006
Messages
47
I am trying to implement a conditional validation Rule. I think it goes like this:

=IIf(([cmbCC].[Column](0))=1,Between 10 And 20,6)

For some reason the true part (Between 10 And 20) is not working even though if I enter a number like :

=IIf(([cmbCC].[Column](0))=1,20,6)

is working just fine. Can someone help me on this please?
 
If its a string your attempting to returned then

=IIf(([cmbCC].[Column](0))=1,"Between 10 And 20", "6")
 
Thanks for trying but is not working. I want to be able to enter integer from 10 to 20 only
 
cherosoullis said:
Thanks for trying but is not working. I want to be able to enter integer from 10 to 20 only

What you need is some VBA code on the Before Update event of the control where you enter your integer.

Basic code is

Code:
If Me.cmbCC.Column(0) = 1 Then
If Me.nameofcontrol < 10 Or Me.nameofcontrol > 20 Then
MsgBox "Enter a value between 10 and 20"
Me.nameofcontrol.Undo
End If
End If

If you're using multiple conditions based on the selected value in your list box,
use a SELECT CASE construction in your VBA code.

RV
 

Users who are viewing this thread

Back
Top Bottom