Thursday, August 20, 2009

New Sample: Form_CustomAutoComplete


by A.D. Tejpal

This sample db demonstrates customized auto-completion of data entry as per area of interest. Based upon desired profile (i.e. area of interest, e.g. Aviation, InfoTech, Medical etc) as selected in the combo box, reference phrases meant to be used for auto-completion get displayed in the subform at left.

The auto-complete feature comes into play as soon as typing commences on a new line in the text box in subform at right. Appropriate portion of text from closest match in reference phrases gets displayed next to the cursor, shaded in selected state, as suggested continuation. If the user wishes to accept the suggested continuation, pressing right arrow clears the shading, converting it into accepted text.

On the other hand, if the user continues typing further, the shaded portion of suggested continuation continues to shrink correspondingly, so long as there is no deviation from reference text. As soon as there is a deviation, new suggested text, as per next closest match with reference phrases, gets displayed, duly shaded - and so on.

At all stages, currently matching reference text is shown highlighted in special color, on the subform at left.

If no match is found within the selected profile, a search for matching reference text in other profiles is conducted. If found, the particular phrase is used for auto-completion. Simultaneously, its linkage to current profile is implemented.

If desired, the user can also type fresh reference text directly in the subform at left. Records for reference text, freshly added during current session under a given profile get highlighted in special color.

If newly entered data contains completely new sentences (marked by line breaks) not present in reference table, these are added to this table after obtaining user's consent via form's BeforeUpdate event. Simultaneously, appropriate linkage to current profile is established by inserting necessary entries in bridging table T_Link (many to many relationship).

Version: Access 2000 file format.

You can find the sample here:


No comments: