Pages

Monday 28 November 2016

1 - Adding a Checklist to MS Access

Demo of a Checklist in MS Access You might be tempted to do this by creating a set of fields across in your table, however this is not considered good design. A better way would be to have a table with the check items individually listed in the table. In this Video I would like to demonstrate one method of achieving this. The minimum number of tables required to make this work is 3 tables, I have given these generic terms: master, data and list. To explain the use of these tables I will refer to a specific case. Consider a business which manages weddings for couples. In this case the master table "tblMaster" will contain details about the "wedding planners" customers. The data table "tblData" will store the data for each individual customer. Finally a table "tblList" that lists the "check off" items that need to be transferred to the data table "tblData". The transfer of the list into the data table is performed by just two functions "Copy List" fCopyListToData, and "Append List" fAppendListToData. There are several other supporting functions in this example. fCopyListToData puts the data from the list (tblList) into a recordset and then loops through the record set extracting the Row information from each field, then transfers that information via the function fAppendListToData into the data table "tblData". "tblData" is what this code is about, it is this set of data that is created. Looking at the data table (tblData) we have five fields: dataID, dataLinkID, dataSets, dataItems and dataTickedOff. dataID is not necessary and can be ignored. dataLinkID is used to relate the values in this table (tblData) to the master table (tblMaster). "dataSets" would not be necessary if you only had one set of data in your list. It is quite common to have a list divided into separate sets of information so in that instance it would be required and really for a single list with only one set, then you just add a "1" (or some other identifier) and treat it as if it was a set from a number of sets. "dataItems" links back to the table list "tblList" and can be used to find the string value related to each item. "dataTickedOff" is a boolean field which allows you to to flag whether a list item has been done, or not done.

No comments: