[AccessD] data validation

Gustav Brock Gustav at cactus.dk
Fri Apr 8 02:27:38 CDT 2011


Hi John

I think a lot depends on your user interface.

We do a similar thing when filling in time sheets for a day. Nothing fancy. If you enter a time and duration, and that overlaps an existing following period, it shifts the start time to the end of that period and calculates the end time. If the end time will overlap a later period, that period is shifted to have a start equal to the end time of the period you entered.
If a period is shortened, a free slot is created as it cannot know if you plan to enter a new period into the free slot or move the following period back to remove the free slot.

The tricky part for us is that you can enter start/end time, start time and duration in hours:minutes, or start time and duration in decimal hours. All four entries can be edited and then the others are adjusted and rounded correctly as are the sum of periods. Again, nothing fancy once you have got the hold on it. No classes and though I haven't the code at hand, I recall most adjustments are done with a simple loop through the recordset (recordsetclone) holding the periods, thus no queries.

/gustav


>>> jwcolby at colbyconsulting.com 08-04-2011 04:46 >>>
Scenario:

I fill out a pass request = date / time from / time to.
The pass request's time from needs to be < the Time to.

Three detail records - location / time from / time to.

The detail record's time from needs to be >= the pass request time from and <= the pass request time 
time to.

Any subsequent detail record needs to follow the same rules but also needs to be after the first 
request's time from / to.

Any change to any time needs to re-perform the validation.

Pass request:

5/1/2011 08:45 - 13:00

Detail record:

Church 09:00 - 11:00
Restaurant 11:00-12:00
park 12:00-12:45

There must always be a pass request date / time
There must always be one or more detail records.
There may be up to three detail records.

How would you perform data validation in this scenario?

I vote for a pair of classes - time class and supervisor which is the pass time and has code to 
check the details against itself, with a collection to hold the time classes.  Time classes have 
code to compare itself against another time class.

Etc.

I have never had to do a validation like this but now I need to.

-- 
John W. Colby
www.ColbyConsulting.com 





More information about the AccessD mailing list