Friday, July 31, 2009

New Sample: Report_PseudoGraphs

Report_PseudoGraphs

by A.D. Tejpal

Explanatory Notes This sample db demonstrates simulated graphs on access reports, using a single text box for a given series. The following situations are covered:
  1. Monthly salary as per scales notified from time to time. For a given month and year, the most recent scale notification upto that month year becomes applicable. Whenever there is a change in salary from one month to the next, different back color is assigned so as to facilitate visual appreciation.
  2. Room bookings.
  3. Score sheets for star war games depicting the initial count of units for engine impulse, engine warp-1, engine warp-2 and superstructure. Depending upon field values in source table, series of numbered boxes are depicted.

Note: (a) Simulation of graph using a single text box is implemented by suitable manipulation of report's MoveLayout property. (b) In form F_Salary, the technique for programmatically positioning specific block of records appropriately in the display window of subform control showing notification of salary scales, is also demonstrated. (c) In order to keep sample data for salary scales current with respect to the present year, update query named Q_SalaryMaster_UpDt is executed via load event of form F_SwitchBoard. While undertaking practical adaptation of this sample db, this statement should be disabled.

You can find the sample here: http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=509.

.

Tuesday, July 28, 2009

A Business Case for Micrsoft Access

I read the following article some years ago and just recently ran into it again. It details how Access can be used as a part of an organization's over-all business strategy.

Database Evolution: Microsoft Access within an Organization's Database Strategy
by Luke Chung, President of FMS, Inc.

Here's a part:

Abstract

There has been a lot of confusion over the role of Microsoft Access within an organization. Sitting between the power of Excel and client server databases, Access extends from simple end-user tasks to mission critical operations. This paper hopes to cover the issues surrounding Access:

  • Why it's become problematic in large organizations including the Sarbanes-Oxley Act (SOX)
  • Where it's appropriate to be used, and
  • Where it's not

It also focuses on the overall principle that most Access applications that become mission critical did not start out that way, but evolved into that role.

Software applications share many similarities with biology and Darwinian forces. Some applications evolve and survive, while others go extinct. Anticipating, rather than fighting, the inevitable process of database evolution and natural selection is the key to using Access effectively within an organization.

Read the rest of it here: http://www.fmsinc.com/MicrosoftAccess/Strategy/index.asp.

It's well worth it.

.

Thursday, July 2, 2009

New Sample: Form_CustomSeriesByDefaultProperty

Form_CustomSeriesByDefaultProperty

By A.D. Tejpal

This sample db demonstrates a novel approach involving generation of alphanumeric sequence as per specified prefix, via a common function embedded as default value property of the bound control carrying such values.

As the data entry progresses, the default value keeps incrementing as required, without having to undertake any special manipulation via form's current event. Moreover, it is not necessary to use even other form events like Dirty / Before or After Insert / Before or After Update etc.

The prefix is selected via combo box on the main form. Whenever, a new prefix is selected, the newly displayed default value on the subform gets set 1 higher than the existing highest in alpha-numeric sequence pertaining to the selected prefix. If there is no existing entry with the given prefix, the default value gets set to prefix followed by 000001.

Type of prefix can be selected via the option group as follows:
(a) Prefix by combo box selection.
(b) Prefix as per current year (yyyy)
(c) Prefix as per current year month (yyyymm)

You can find it here: http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=471

.

Monday, June 22, 2009

New Sample: Query_SplitToMultiRowsReMergeSorted

Query_SplitToMultiRowsReMergeSorted

by AD Tejpal

Explanatory Notes

This sample db demonstrates splitting of comma (,) or star (*) separated string elements into multiple rows followed by re-merging of these elements duly sorted, back into strings. It is a virtually codeless solution, but for use of two wrapper functions related to built in Split() function.

For splitting the strings into multiple rows, a single field table (T_Ref) populated with numbers 0 to 10 is used in Cartesian join with the table holding source data. The sorted output is appended to table T_Jobs_Split, which in turn is used to generate the crosstab query followed by final select query, re-merging the sorted elements back into strings.

Note:
(a) If the maximum number of elements in one string is likely to exceed 10, additional numbers can be added to table T_Ref. At the same time, pivot clause of crosstab query and calculated field of final select query (based upon crosstab query) will need o be expanded to accommodate additional columns.

(b) Use of number reference table (as compared to master job table) in Cartesian join with source table for generating multiple rows has the advantage that it eliminates the risk of inconsistent results arising out of partial match using Like operator. Moreover, it does away with the need of preparing such a table and keeping it up-to-date, apart from ensuring that there is no inadvertent discrepancy in its contents.

Version: Access 2000 file format.
Reference: DAO 3.6

You can find the sample here: http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=459
.

Tuesday, May 19, 2009

How do I Create an Application in Microsoft Access?

Application Development Process

I am often asked how I create an Access application. That’s a difficult question because each system has different business rules. However, there is a more or less standard process I go through when creating any database application. That's what I'll describe here.

Data Collection:
I start by collecting as much data as possible.

If the application is to replace an existing system (either paper or electronic) I will collect samples of all paper forms, data entry forms, printed reports, other outputs (like emails or documents generated), plus any documentation.

Basically, I want to collect all input and output from the current system. It's a pretty simple idea. All data elements on any input or output form must be represented somewhere in the database. But it's surprising how often data elements are missed simply because the developer didn't look at all the forms or reports.

Lastly, I'll interview everyone involved with the application. This includes both management and staff. Often, the administrative assistant who will be entering data into the application has insights that management (with its broader view) will miss.

If it is a brand new application, it's a little more difficult because I have to rely on what people think they need, which is often incomplete. This requires several rounds of interviews. I have seen too many bad applications which were based on a single client interview.

Database Design:
This is the single most important part of the process and should take nearly as long as the application development itself. If you get the design right in the beginning, the application development goes much more smoothly.

I follow an abbreviated version of Michael Hernandez's process from his book "Database Design for Mere Mortals". This book stresses process, rather than the academic niceties of Normalization. As Hernandez suggests, I start with an analysis of the entities and how they relate to each other. The final result is usually nearly normalized.

This process cannot be entirely divorced from the Implementation process (in my mind at least), because as I design the tables and relationships, I am already getting an idea of how they will be implemented. (Part of the Hernandez process is to identify Mission Objectives. These usually end up translating into forms or reports.) At the end of this process, I have an ER diagram and a scope document.

For more details of this process, see my blog serie:
What is Normalization?
and
Entity-Relationship Diagramming
or you can download them here:
http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=238

Database Creation:
Not to be confused with Application Design. At this point, I create all of the tables and relationships in my design. This becomes the Back-End database.

Nearly all of my databases are "split". Access allows you to create an application where the forms, reports, and tables are all in the same file. But for most applications, it is useful split the database in a "Front-End" (FE) and "Back-End" (BE). The tables and relationships to in the BE, while everything else (forms, reports, queries, and code) go in the FE. The BE is the "database" and the FE is the "application".

Application Design Philosophy:
There are many methods for applications development. Two of the most common are Top-Down and Prototyping.

In the Top-Down approach, you collect customer requirements, create your forms and reports, present it for customer approval, develop the application, test it, deploy it, then maintain it. The problem with this approach is that you have to understand the customer's requirements (and they have to understand their own requirements) thoroughly before you can start designing the application. If you get something wrong and the customer doesn't catch it during the presentation stage, you can produce something quite unworkable for the customer.

Prototyping is similar to the top down approach, but you do it in small sections of the application, creating quick, working samples for the customer to play with and critique. During this process, you may discover that what you understood the customer wanted wasn't really what they wanted.

The prototyping approach requires more customer interaction, but it allows you to get immediate customer feedback. As a Rapid Application Design environment, Access is a perfect prototyping tool.

I should point out that this ONLY applies to the application development phase. The database design phase for both approaches is nearly identical. You should try to figure out as much about the customer's data needs before beginning the application development. However, using the prototyping approach, you will discover flaws in your database design (and allow you to correct them) before you get too far into the project.

Application Creation:
I start with a BoilerPlate database which has many standard forms already built. (I have a couple of samples on my website.) Every application will need a main screen, forms for maintaining lookup tables, a form for running reports and so forth. Using a boilerplate also gives a measure of uniformity to my applications. I link my tables into this and it becomes the Front-end.

Next I create the Maintenance forms. These are the forms that the user can use to modify the data in their lookup tables. The forms are standardized so the user gets used to the way they work. My boilerplate has a form which lists all of these forms (they all have an "mnt" prefix) in a list box, so the user can just select the table they want to maintain and the appropriate form appears.

At this point, I either give the unfinished application to the user to fill the lookup tables manually or have them send me a spreadsheet with the information that I can import to the lookup tables.

My next step is the main data entry form. In most of my applications, there is a main transaction table that will be the entry point for most data entry. If I have a design like this:

Patient ---< Visits ---< Diagnoses ---< Treatments

I try to determine which one is the main transaction table. In other words, which will I be using most and is the most logical starting point. (To be sure, this is a subjective process and there are many ways it could be done.) In this case, I would probably start with Visits. I'd have a combo box to allow for the selection of the patient and also a button that would launch the Patient form for adding a patient that is not in the list. (Boilerplate.mdb has an example of this too.)

Most of these samples (with the exception of Training Registration and Books) are not full applications, just the bits necessary to illustrate the main problem. There may be multiple data entry forms. For instance, in the Training Registration sample, there is a form that allows you to enter students and assign them courses. There is also a form that allows you to enter courses and assign students to them. Two different ways to do the same thing.

Deployment and Testing:
With the prototyping process, there is no single deployment stage. The application is deployed for testing throughout the process. However, at some point, the input part of the application is "done" and is ready for use. At this point, I deploy the application to the user to fill with TEST transaction data. I emphasize that they need to use REAL data just as they would in their daily work.

However, I emphasize it is still test data. I will delete all of it just before we put it into production. Using real data will quickly point out any flaws in the design and allowing a knowledgeable user to test it will highlight problems that I as the developer cannot find. As they find problems, I will address them. This is all part of the cyclical prototyping design process that I follow.

Reports and other Output:
Once they have a good group of representative test data, I produce the reports that they requested back in the design process. When these are done, I wipe out the test data and deploy the final version to the customer.

A Word of Caution:
The process I've described here is just the development side of application development, not the business side. Here, I've ignored the business side which includes a proposal, objectives, milestones, customer signoff, formal testing procedures, documentation, and invoicing. This is meant to give you an idea of a general process for you to create your own database application.

.

Tuesday, May 12, 2009

New Sample: Report_RepFooterformultiColumns

Report_RepFooterForMultiColumnsSample

by AD Tejpal

This sample db demonstrates handling of report footer for a multi-column report with Down and then Across (D&A) layout in such a manner as to prevent its spill-over to a redundant extra page.

In a multi-column report with D&A layout, spill-over of normal report footer section to an extra page, despite adequate space being available at the end of last column, is attributable to the fact that page footer has already been hit by the first column. Once that happens, there is no longer any room for the report footer, which has to move over to next page.

Two alternative styles are demonstrated in this sample db:
  1. Style A - Use the page footer in dual role.
  2. Style B - Place the report footer in an outermost dummy group footer.

You can find the sample here: http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=454

.