MS Access - Formatting
Ms access tutorial
MS Access - Formatting
A particularly useful formatting tool in Access is the ability to apply Conditional Formatting to highlight specific data. Consider a simple example of conditional formatting.
In this example, we will be using a fSubCurrentProjects form in our database.
We have a list of all the projects in this database and we also have some new fields like the Status on time and Number of overdue tasks . This form is created from another query.
In this request , we have a join between a table and a query that will display the number of due dates or the number of projects with overdue tasks. We also have a calculated field here that uses the IF function to determine if the number of the due date is greater than zero. It will then display the words Overdue if the project is late or On time if this special projectcific has no overdue tasks.
In this example, we'll use the form above to understand how you can use conditional formatting to highlight specific information. We will now highlight each project that is currently overdue. To apply conditional formatting to one field or to multiple fields, we will need to switch to the Layout view.
Now select the Status on time field.
Now go to the Format tab.
On this Format tab, you should see a group called Control Formatting and a special button for Conditional Formatting. Now let's click Conditional Formatting.
You will now see a conditional formatting rule manager and we currently have no rules applied to this control. Now let's create a new rule by clicking on the New rule button.
You will now see a New Formatting Rule dialog box. We will first specify the type of rule we are going to create and here we have two options. The first option is to check valuesin the current record or to use an expression , and the second option is to compare this record with the other records .
We now only have one of the tw o values in our form; either On time or the word Late and which comes from the given request. Now let's select the " Field value is " in the first combo box, and then select " equal to " in the second combo box. Now type the word " Late " in quotes.
We can now set our conditional formatting, what we want this field to look like if the word Late appears in this field. Now let's change the font color to red and make it bold, italic and underlined , and c 'is our conditional rule. Now let's click on Ok , then on Apply , and again on Ok .
You can see that the word Late is formatted now. Here is an example of creating a rule.the one of very basic conditional format.
Let's take another example. Here we are going to make the title or project name red and bold, italic and underlined . Select the project name control on your form.
We will now go back to our Format tab and click on Conditional Formatting and create a new rule for that specific control as shown in the screenshot above.
Here we will not be checking the value of the current field as we have selected, but we will check it against another field in this form. Select Expression Is in the first drop-down list then click on the ... button at the end as in the screenshot shown -dessus.
In the categories of expressions, you have every object that is on this form. Double click on CountofDueDate . This will send the reference to that control or field to our expression generator and the condition if it is greater than zero. Now click Ok.
Now let's click on Ok, then click on Apply and again on Ok.
This was an example of conditional formattingon a field based on the values of another field.
Now let's look at another example of conditional formatting. Suppose we want to see which projects are more overdue or have more overdue tasks than other overdue projects. Select the Conditional Formatting option.
Click on the button New rule to create a new rule, then click OK as in the screenshot above.
In the new formatting rule, we are now going to select a rule type " Compare to other records ". Let's change the bar color to red again. We want our shortest bar to represent the lowest value and the longest bar to represent the highest value. Now let's click Ok, then click Apply and then click Ok again.
You can now see the conditional shading applied like in the screenshot above. Now let's go to the Form view.