[AccessD] More Class lectures?

jwcolby jwcolby at colbyconsulting.com
Thu Feb 12 13:51:42 CST 2009


 >so far today I've managed to get a couple classes working in in a major rewrite of a client app 
I'm doing and quite pleased with the results so far.

YEA GO WILLIAM!!!  Now THAT makes it all worthwhile! ;)

I have indeed learned a trick or three in the years since.  The basics of classes is really pretty 
simple but the things you can do with them OTOH are mostly limited by your imagination.  It is 
definitely true that as you apply them, your mind starts to expand to see how you could do other 
things as well.  The more you use them the more you can think of ways to use them.

I have a state machine in a client application, the Disability Insurance call center.  Events that 
occur to the claim directly determine the current state of the claim, and the state of the claim 
determines the possible states that the claim can go to.  The state of the claim determines what 
events can occur to the claim.

So you have two tables that have possibilities, the tlkpClaimStatus table (the statuses that the 
claim can be in) and the tlkpClaimEvent table (the events that can occur to the claim).

The tmmValidNextStatus says "if you are in this status, then you can go to these other statuses". 
For example:

Status		Next Status

Appeal	> 	Re-Opened
Appeal	> 	Terminated
Appeal	> 	Open

Open	> 	Terminated
Open	> 	Suspended
Open	> 	Transferred Out

The claim has an event child table that stores all of the events (and current status) that have 
occurred to the claim, and there is a combo that tracks what the current status is, and displays the 
events that can occur, and what status each event would place the claim in (assuming it would change 
the status).

It is a rather complex state machine system, but it is critical that it function correctly because 
if it doesn't then the user could place the claim in a disallowed state by selecting an event that 
is not allowed in the current state.  That event combo MUST only present events to the user that 
will not place the claim into a disallowed state.

That kind of thing is what classes are about.  As you might imagine this requires a handful of 
classes to efficiently process the system.  One of the classes handles this combo.  It builds up a 
query of the valid events, it handles the after update to build the event and store it in the event 
table, then build up the query that displays the valid events based on whatever the current status 
is after processing that last event.

It would likely be impossible to really build a complex system like that without classes, or if it 
were possible it would be so wonky that maintenance would be horrendous.  Even with classes it was 
not a trivial programming project but I wrote it and it works well.  More importantly the whole 
thing is table driven, meaning the client can add entries into tables to add events that can occur, 
what state the event would cause the claim to be placed in (if any) and so forth.  Furthermore code 
can add events to tblClaimEvents, for example when they mail merge a document request to a doctor, 
an event is created that shows the document request was created (the claim state did not change).

This kind of Event / Status system can be used in many different businesses and classes can help you 
build such a system.

John W. Colby
www.ColbyConsulting.com


William Hindman wrote:
> ...when I first ran across jc many long years ago when he was still playing 
> expatriate down in old Mexico, I purchased his first jit sample mdb with 
> documentation ...great sample much of which I still use today ...but the 
> document was the most obtuse thing I'd tried to read in ages ...and I've 
> poked him more than a few times over the years when he starts talking above 
> my head again ...but I must admit he's learned a trick or two over that time 
> :)
> 
> ...as for the lessons, I'm barking up his shins and afraid to go any further 
> north lest I find something truly hairy ...I've used With Events since 
> Shamil first started hawking them on this list but never got into classes 
> with Access ...so far today I've managed to get a couple classes working in 
> in a major rewrite of a client app I'm doing and quite pleased with the 
> results so far.
> 
> William



More information about the AccessD mailing list