[AccessD] Validation of a control

Arthur Fuller fuller.artful at gmail.com
Wed Apr 23 08:26:38 CDT 2008


It appears that I cannot use the validation rules. I tried something almost
identical to what you wrote and I get a message telling me that I cannot set
a validation rule for a linked table. So instead I'm using the BeforeUpdate
method and something really funny is going on here. I edit a value that I
know is valid, and change it slightly, remaining well within the boundaries,
and Access tells me that the value is less than the permitted lower
boundary. Even though the number put in is only one different that the
existing value. If I then press Escape and restore the original value,
Access accepts it. Maybe that's because I haven't triggered the BeforeUpdate
code by doing that. Maybe I have to do the same thing in the OnExit code
too.

Back to the drawing board.

On Tue, Apr 22, 2008 at 11:19 PM, Stuart McLachlan <stuart at lexacorp.com.pg>
wrote:

> If you really have to use the control validation rules, then you can do
> this:
>
> Private Sub c1_Exit(Cancel As Integer)
> c2.ValidationRule = "=>" & c1.Column(1) & " and <=" & c1.Column(2)
> c2.ValidationText = "C2 Must be greater than or equal to " & c1.Column(1)
> & " and less than
> or equal to " & c1.Column(2)
> c3.ValidationRule = "=>" & c1.Column(3) & " and <=" & c1.Column(4)
> c3.ValidationText = "C3 Must be greater than or equal to " & c1.Column(3)
> & " and less than
> or equal to " & c1.Column(4)
> End Sub
>
>



More information about the AccessD mailing list