Stuart McLachlan
stuart at lexacorp.com.pg
Tue Apr 22 22:19:35 CDT 2008
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 On 22 Apr 2008 at 16:27, Arthur Fuller wrote: > C1 is a zone, which dictates the ranges of the values of C2 and C3. In the > course of my experiments I have discovered that Access won't let me dictate > the validation string of a linked table. Now I'm really flummoxed. I think > that I may have to hard-code this with a Select Case block and while I'm > fairly confident that the number of Zones is not likely to change soon, I > hate going this way. But we do what we must do. > > This is the general idea: > > Zone EastMin EastMax NorthMin NorthMax > 17 200 300 42000 48000 > > C2 and C3 are the values of East and North. They must fall within the range > dictated by Zone 17 in this case. > > Arthur > > On Tue, Apr 22, 2008 at 4:07 PM, Dan Waters <dwaters at usinternet.com> wrote: > > > Are you trying to validate C2 and C3 when you are entering the data into > > those fields and after you've made the selection in C1? > > > > Are you looking at the BeforeUpdate event in C1 or in C2 and C3? > > > > Also - are these fields bound? > > > > Dan > > > > -----Original Message----- > > From: accessd-bounces at databaseadvisors.com > > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller > > Sent: Tuesday, April 22, 2008 1:24 PM > > To: Access Developers discussion and problem solving > > Subject: [AccessD] Validation of a control > > > > I am not managing to get this right despite numerous attempts. Let's call > > the controls C1, C2 and C3. C1 is a combo which contains 5 columns. The > > first is its ID, the second and third are the min and max values permitted > > in C2. The fourth and fifth are the min and max values permitted in C3. > > > > Perhaps because I am using some fancy code inherited from Gustav and > > Shamil, > > I seem to have lost control over the BeforeUpdate event, so I am leaning > > toward the Validation attributes instead. Let's suppose that the item > > selected in C1 contains 100, 120 in columns 2 and 3 and 500, 700 in > > columns > > 4 and 5. Once the user has selected one such row in the combo C1, how do I > > rewrite the validation statements for C2 and C3? > > > > TIA, > > Arthur > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com