Conditional Field Requirements

catbeasy

Registered User.
Local time
Today, 14:13
Joined
Feb 11, 2009
Messages
140
I have a form that if field 1A is populated, then field 1B must also be populated. If Field 1 isn't populated, then field 2 can be either populated or not (null)..

There are 24 "A" fields and 24 corresponding B fields. So for example, if field 1A is populated, then field 1B must also have a value, if field 2A is populated, then field 2B must be populated etc..

Is there an easy way to do this?

NOTE: I am trying to AVOID 2 things (if possible):

1. Putting code that detects this situation when the record is moved on the "On Current" event. I want immediated feedback after updating the "A" field to let the person know they must enter a value in the corresponding "B" field..

2. Adding code to each of the 24 fields to do the validation. Which I'm not sure would be able to force the issue anyway..perhaps it would only notify? Perhaps an input box to enter the value?

If one the above 2 ways that I want to avoid are the only ways to do this, then I'll accept that, but I was hoping that there would be something at the table level (via the table the form is attached to) that I would be able to do something to force a value IF..

Thanks for any assistance..
 
Put your validation in the Form's BEFORE UPDATE event and then you can cancel it (by issuing a

Cancel = True

if the validation fails). The Before Update event will fire any time that a record is dirtied and then a user tries to close the form, move to another record, etc.
 
Since you want immediate validation You have to do it on a field by field basis. I would try using the Lost_focus event of each A field
 
the danger with stuff like this, si that if the user clears boxa, you may sutomatically clear boxb - he then changes his mind, but cant recover the old value

you may need to ask about this in both of the beforeupdates for the textboxes invoved, and then process the event in both of the afterupdate events for the textboxes

worth doing, as it will give a friendly interface
 
ok, thanks to all your contributions, i;ll give it a shot..
 

Users who are viewing this thread

Back
Top Bottom