Need form to display checkbox, radiobutton group, or listbox based on task type - ms-access

I've been trying to whip up a simple MS-Access task-tracking application for personal use. My basic data model is a task-definition table (in which I can define daily tasks) and a task-result table (in which I can track which tasks I've performed on a given day).
I'm trying to build a form which
1) lists all daily tasks (sorted by time-of-day, an attribute of each task), and
2) next to each task, displays a widget that lets me mark the task as complete.
Here's the rub, though. I have three (and may add more) different types of tasks:
simple yes/no tasks (for which a single checkbox widget would work)
score-able tasks that allow me to track how well the task was done (for which a radio-button group would fit), and
"complex" tasks comprised of several yes/no sub-tasks (for which a multi-selection list-box would fit).
I've gotten as far as building the form so it lists all tasks in desired order, but I am 100% stuck on how to code the (conditional) data-entry widget. Though I've had no difficulty in implementing each widget individually, my best effort is a task list with just check-boxes, just radio group, or just list boxes. I have no idea how to tell the form to "look at" the type of each task and present the appropriate widget beside it.
I'm almost ready to throw in the towel and just hard-code all the tasks into the form, in a fixed order, along with their appropriate widget. Is there a way to implement this in a more elegant manner?
[an aside] I chose MS-Access somewhat arbitrarily, and am learning MS-Access forms as I go. If anyone feels I'm stuck by virtue of choosing the wrong tool for the job, feel free to let me know

As resolved in the comments to original question, it seems the main obstacle is the limitations of continuous forms. Because Access treats each column of continuous forms as an atomic element, there are very few options available to differentiate their presentation. The only tool that comes close is Conditional Formatting, and the closest approach to selectively hiding/showing fields is to hide text-box fields using text colors that "camouflage" them into the background color.
This limitation leads to my potential work-around.
To recap the objective: Within a given day, I want to list a [table-driven] set of tasks. Each task has options of "Yes/No", "Choose one of N choices", or "Choose 0 to N of N choices". Depending on the type of task, it should be rendered (respectively) as a single checkbox (yes/no), a radio button group (choose one), or an checkbox group (choose many).
(An aside: I realize, as I type this, that the first type is really a subclass of the third type, but that doesn't really make the core issue go away)
The proposed idea:
At the time the form is launched, a query can be run which will tell exactly which task will fall into exactly which position. In other words, before "drawing" today's tasks, the database can answer which task will be in position 1, which will be in position 2, and so on. Additionally, I can safely say that there will never be more than, say, 20 tasks (though the actual number of task on any given day can vary).
Which leads me to wonder: what if I designed the form with 20 "slots", and in each slot, had 3 overlaying presentations: one for Yes/No tasks, one for a "Choose one" tasks, and one for "Choose many" tasks. (60 total - sounds horrific, but I'd hope copy/paste would come to the rescue).
When Access renders the form, each slot would query for the "nth" task of the day (so the 1st slot would query for the first task, the 2nd slot for the second task, and so on). The "visible" option would then be set to "Yes" for only the presentation that matched the type of task returned by the query. So if the 3rd slot, querying for the 3rd task, received a task of the "yes/no" variety, only the "yes/no" prompt would be displayed.
For what it's worth, I do have a working version of my application already (though checking & unchecking check-boxes according to whether a task is labeled as "pick one" or "pick many" definitely grates on me). So if there's a reason to think this new approach won't work, I'd be happy to hear it before I throw any real development time at it.

Related

How to create a checklist in MS Access that changes conditional formating

I am building a database for maintenance performed on lighting fixtures, each with their own unique serial number. I already have an excel document with all this data, but want to create a better system for managing the data.
The idea is that every time I service a unit, I have a new job #, and fill out a checklist and enter notes for that job. I have created a Job # table, with columns for serial #, date received, date completed, notes etc. I have also created a job form, which includes all the relevant info for that job#. The question I have now is how to create relatively efficient checklists that modify the background color of a text field.
For the first part of this, I need to have a drop down list with different model lights to choose from(each light has different feature sets to test), which, depending on which model I select, will display/generate a checklist, with about 25 items, that is unique to that model.
Then, when all the check boxes are checked for that specific checklist, I need the background color of a text field("Unit Good?") to change from red to green. These check lists need to be specific to the job #/record #, and I'm curious if there's a relatively easy/efficient way to do this.
At present I have about 150 jobs, and it will only increase over time.
My preference is to avoid VBA if possible, but if necessary, some pointers, or recommended tutorials would be highly useful.
I've built the underlying table and form, but haven't yet been able to figure out how to do the checklists.
Any help here would be extremely appreciated. I am happy to provide any additional information/documents if necessary.
Yes, this is possible and it can be done without VBA (although macros are required).
First, you need to create a couple more tables. I'm making the assumption that you only work on one light model per job (multiple models is possible but more complex). You will need to create three tables (two if you already have a table for your light models).
Light_Models will contain information about the light models you service, including their unique serial number.
Model_Checklist_Defaults will contain default checklist values for each light model
Job_Checklist will contain checklist values for a specific job based on the light model you serviced (this is where multiple light models in a job would add complexity). When you create a job for a specific light model, you need to copy the appropriate values from Model_Checklist_Defaults into Job_Checklist (this can be done by creating a query and calling it from a macro, I won't cover this here).
These tables need to be related in the following way Relationships image. I only included the bare minimum columns, you could add more as you need.
You need to create a form to present your checklist, and optionally, other job details. This form assumes that you have already created a job and selected a light model, but you could modify the form to create the job and checklist in one step.
The example form (Form image) has a jobNumber textbox that identifies the current job, a coloredField whose background color changes based on the checklist, and a subform that presents data in the Job_Checklist table filtered by the jobNumber textbox (this filtering is with linked fields in the subform Property image).
The final piece is configuring the coloredField background color and setting a macro on the form, jobNumber and subform to update the coloredField when checkboxes are clicked/unclicked.
This macro need to be set in several places (Macro image):
Form OnLoad event: this ensures that the coloredField updates based on the checklist when the form opens (in case you close and reopen, for example)
jobNumber AfterUpdate event: this field updates the checklist subform when its value changes, so you have to recheck the checklist values each time
subform OnExit event: this event is called after you have clicked into the subform (checking a box, for example) and then clicked on another field in the main form. This event catches the actual checkbox changes.

MS Access data validation between form and subform

I have an MS Access database which tracks invoices. In the form I use to enter the data, I have the control [Amount] for the invoice amount (e.g. $100). In that form there is also a subform which tracks parts of the invoice (e.g. food supplies for $50 and cleaning supplies for $50). The main form also has the control [Breakdown Total] which sums up the breakdown amounts in the subform.
I am trying to make it so that, unless [Amount] = [Breakdown Total], you can't change records within the form. Because of the two-table structure, it seems that a data validation rule isn't working quite the way I want because it really only works when you fill in the [Amount] control and not if you then change the breakdown.
I thought of building an event to handle this, but I don't know what event to use--BeforeUpdate doesn't let me leave the control which doesn't match, which isn't helpful--what if that's the correct one?--and AfterUpdate doesn't seem to let me require that the suspicious record remain on the screen. Could someone please recommend the event I should be using?
Here was a solution i implemented at a client, recently. Not sure if it is exactly what you need but implements two ListBoxes, one to select the Top-Category and the other is Column'ed to display a Cross-Tab display of the Top-Category's children.
The Left Listbox is programmatically, in VBA, loaded information from an Access View and then the main-body Listbox is bound by a Cross-Tab creation algorithm. Now yours does not necessarily have to be as intracate or detailed as mine required. But you can get this done without a subform.

Access--I need a list of dynamic check boxes on a form

I am trying to create a form in Access which will have a dynamic list of check boxes. It starts with a table tblMASTER_ATTACHMENT_LIST which will have three columns: MASTER_ATTACHMENT_ID, CLASS, and ATTACHMENT_NAME. (Before I go any further, this question is not about file attachments. Think more along the lines of an attachment to a report.) tblMASTER_ATTACHMENTS will be "pre-populated" with all possible reports and their classification. There will be another table tblREPORT_ATTACHMENTS, which will have the following columns: ID, REPORT_ID, MASTER_ATTACHMENT_ID, and ATTACHED_BL (boolean). So, depending on the class of the report, the list of possible attachments may change. I would like the list of possible attachments to be populated on a form, with check boxes next to each one to show whether it was actually attached or not.
I was thinking about a workflow such as once a user selects the class of report, to delete any records in the tblREPORT_ATTACHMENTS with the REPORT_ID equal to the current RECORD_ID, and then fill the form control with the results of SELECTing the records from the master table where CLASS = selected class.
If this workflow makes sense, I could use some help implementing it. Specifically, how do I build the control on the form that will hold the check boxes? If this workflow is not a very smart way to do, can someone suggest a better way? And explain how to do it?
By the way, I did search for this, but I don't really know what this type of thing is called. Makes it pretty hard to search for. If this is a common thing, perhaps someone could just point me in the right direction. In that case, a full answer here would not be necessary.

customize initial data issue and solution

I want to design an object for loading and showing customized data, for example, the object firstly loads all employees in database, then look up whether login user in the list, if so then show the login user, otherwise show dummy data "all employees"(means null). But another scenario is the component should "remember" last time user selected data and show in another page, any good design suggestion?
You describe four major pieces of function:
checking the user against a list
identifying one of two scenarios
remembering selected data
using the remembered selected data
Overall I don't think you've decomposed the problem enough yet to start thinking about design patterns - patterns become important once you've identified some candidate classes and start to look at how to decouple them. So my next step would be to design some classes to do these 4 tasks and then critically example the resulting Object model, see whether refinement is needed. THe first step: identify classes with clear interfaces and responsibilities.

How to display changed fields

I am working on Audit Trail for my project and I have been asked to think of how can we display the fields which have changed between two versions. I have the list of changed fields I am looking for suggestions on how to display the fields so that user can easily find out:
which fields have changed
what was the old and new value
A simple approach will be to display the old and new values in grid with the top row showing new values and the bottom row showing the old value.
But this one is very basic approach
another one i thought of was to display the changed fields in color so that the user understands that these fields have changed but in this case he will not be able to get the old value of the fields.
If any one has some innovative ideas kindly let me know.
Thanks
Your idea of showing colours would be a good visual aid, but perhaps a list of changed values below the main record would also be beneficial, so you could have an "at a glance" view.
Something akin to:
Firstname: Phil -> Philip
Email: phil#example.com -> phil#someotheremailprovider.com
A bit more innovative, but non standard so potentially open to usability/training issues, would be the coloured input field that when you mouseover/focus launches a bubble to the side with the old value.
Several possibilities come to mind whose suitability depends on the user’s task (doesn’t it always?):
Task: Get a general quick overview of how things have changed in a window. Here the user needs to compare the old values along with the new, but doesn’t necessarily need to check every single field.
Design: Provide a toolbar button and/or accelerator key that swaps the new values with the old. If this can be done instantly (<500ms), the apparent animation will naturally draw the user’s eye towards places where the greatest changes were made. This is especially effective if the content is graphical (e.g., slider values, graphs, or editing an image)
Task: Crosscheck every change of every field to make sure new values are correct. In this case knowing the old values is at most a secondary task (i.e., only occasionally will a user care what the field used to be).
Design: Prominently mark the fields that have changed (see last paragraph) and show the old value as a tooltip with mouseover.
The above designs have the advantage that you can use the “normal” window intended for non-auditing purposes, cutting down on the number of windows users need to learn.
Task: Detail evaluation of how each field has changed, including perhaps a long history of multiple changes for each field, followed by occasionally correcting a value based on the history.
Design: On selection of a menu item, the window expands vertically to show old values in a read-only list below each new value. For long histories, such a list may need a scrollbar. For most alphanumeric values, it’s easier to scan vertically to see how things changed character by character than to scan horizontally. You should allow the user to edit values when in this mode and also select a value on the history list to revert the field. Saving pushes the now old values of edited fields onto the list. Tooltips may be used to provide secondary information (e.g., when each value in the history was entered and by whom).
Design: For “heavy” fields, like a large rich-text box, consider a display mode that uses strikethroughs and highlighting to show changes within the field, such as done by MS Word in Track Changes.
The above two designs still use the “normal” window, which minimizes learning, but modifies the window’s size and layout, requiring somewhat more learning and re-orientation than the first two designs.
Task: Find when and who changed specific fields. Here, the user already knows or suspects which fields have been changed and what the new values are, but now wants to know how they got that way.
Design: If the users generally needs to check only one field, then a menu item opens for the field that currently has focus a small window with a grid listing the history of values, who changed them, when they changed them, and any other auditing information (e.g., who approved it and when). If histories tend to be long, provide sorting and/or filtering. You can provide a command button that sets the current field value to one selected from the history grid. Note that this is different from the list using tooltips in that the user is primarily interested in figuring out who and when the field changed, not in what the field should be –it’s easier to scan through the timestamps, but harder to revert a value.
Design: If the user is likely to need to check and compare multiple fields in a window, provide a closeable history pane rather than a window. As the user tabs through the fields in the window, the pane updates instantly with each field’s history, complete with timestamps and usernames. A menu item can revert the field to a value selected in the pane. This is suitable for a user group for whom auditing is a fairly regular task, not an exception rare done.
The above two designs minimally disrupt the “normal” window, but require the user to learn an entirely new window or pane.
Task: Reconstruct the evolution of data objects through multiple updates of multiple fields. In this case, correcting values is not part of the task.
Design: Provide a general audit window for any arbitrary list of fields or objects, allowing the user to query/filter by fields, field values (e.g., to answer, “when was this ever X?”), windows, database tables, and, of course, timestamp range. In addition to supporting ad hoc query, you can allow the user to open the auditing window for all the fields shown in their current window. You can also provide an easy way to populate this table with fields the user regularly needs to audit or with fields that automation determines should be audited. The audit window shows a sortable grid listing the timestamp, data object (or table), field, old value and new value, and username. When sorted by timestamp (perhaps should be the default), the user can infer how changes influenced each other across fields (e.g., User A change X to 2, which probably led User B to change Y to 4). You may want to provide graphing options to help the user see correlations in changes. This is the most powerful auditing tool of the designs I’ve given, but it also requires the most training and skill to use.
For all the designs, it’s indeed a good idea to color-code recently changed fields to help the users spot what they are likely looking for (i.e., something different than the last time they looked). You may even want to have three or four gradations of recentness. I’d choose a bright color to suggest “newness,” but I’d avoid red which implies something wrong (not necessarily the case) or a required field. How about a sunny yellow “halo” around the field? Something like border will avoid issues with readability of the field. For accessibility reasons and better self-documentation, I would also include a redundant cue such as an alt-tagged icon (maybe a “sparkle”?) or simply the word “new” beside the field.
If each field contains fairly simple data then I might just have back and forward buttons so that you can toggle between previous and current view. In the current view (or perhaps both views) highlight the fields that have changed. The previous view should provide some visual cue that the fields are disabled (like greying them out). This gives you locality with respect to the change set (i.e. the user can quickly see what values changed) without too much visual clutter.
I'm lazy, so:
Turn the old data into text
Turn the new data into text
Use diff to show the differences
Educate users about how to interpret diff output