[AccessD] data validation

jwcolby jwcolby at colbyconsulting.com
Fri Apr 8 08:00:48 CDT 2011


Thanks Gustav.

I haven't wrapped my mind around the "how to" do adjustments.  The data is entered into a main form 
(pass request) sub form (request detail), with the request detail being a continuous form.  AFAICT I 
can't write back to the subform controls because (AFAIK) doing so writes that value into every 
record.  I would have to write them back to the table using SQL and then requery the subform to show 
the changes.

An additional issue is that these forms are bound to SQL Server data through linked tables.

I too am looking at using the recordset clone, however one of the issues I am trying to work around 
is that if I move to binding the form to an ADO recordset, then the RecordsetClone property becomes 
non-functional.

I am going to put this in the "ToDo" file I think and get some other, less... "complicated" issues 
handled first.

John W. Colby
www.ColbyConsulting.com

On 4/8/2011 3:27 AM, Gustav Brock wrote:
> 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.
>



More information about the AccessD mailing list