I have a form for recording the phone numbers which have two kinds:
I want to make the ValidationRule change according to the Combobox that determines the type of phone numbers.
I tried to use ValidationRule in the form properties but it doesn't work with IIf
formula or dependening on the value of another textbox or combobox.
So I made this piece of code, but it doesn't work:
If me.combo.value = "internal" then
Me.field.validationrule = "Len([field]) = 4"
ElseIf Me.combo.value = "external" Then
Me.field.validationrule = "Len([field]) = 4 or Len([field]) = 7 or Len([field]) = 8"
End If
Thanks in advance.
You don't have to change the validation rule. Try something like this instead:
([combo]="internal" And Len([field])=4) Or ([combo]="external" And (Len([field])=4 Or Len([field])=7 Len([field])=8))