validation rule

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi
does anyone know how to set a validation rule based on the answer to a combo
box...

eg - customer provides a phone number in one answer then is asked "do you
want an SMS notification" - a yes is only valid if there is a mobile number
on the previous field
 
A validation rule would look something like ...

[Notification]=False Or [MobileNumber] Is Not Null

However, there's not much point in using a validation rule like this in a
form. If I was going to use the validation rule, I'd do it in the table. In
the form, I'd disable the notification check box, and enable it in the
current event procedure of the form and the after update event procedure of
the mobile number text box, only if the mobile number text box contained a
value ...

Me!chkNotification.Enabled = (Len(Me!txtMobileNumber & vbNullString) > 0)

It's always better, if possible, to avoid offering an invalid choice rather
than to offer it and then throw an error. Think about how it looks to the
user ...

What's your mobile number?
I don't have one.
Do you want an SMS notification?
Yes please.
Well you can't have one, stupid, because you don't have a mobile number.

.... as opposed to ...

What's your mobile number?
I don't have one.
OK. Unfortunately, I can't offer you the option of an SMS notification
without a mobile number, so let's move on ...

Which program would you rather use?
 
Back
Top