Combine visual elements in your Access reports with this bar chart trick.
Here's a way to combine the visual elements of a bar chart with the text elements of your reports: Generate a horizontal bar chart based on a value that appears in your report. For instance, if you're reporting on test grades, you might use a horizontal bar in addition to (or instead of) a traditional numeric score. Here's how:
- First, create a new report and add any text fields you want to display on each row.
- In Design view, create a new text box as the rightmost field in the Detail section. To leave plenty of room for your horizontal bar, drag the right edge of the text box out to the report's right margin.
- Right-click the text box, choose Properties, click the Data tab, and enter an expression like the following for the Control Source property:
When you preview the report, this expression returns a series of plus signs. The number of characters it returns depends on the value stored in the specified field.
Use the Chr function instead
In addition to typing a literal for the String function's second argument, you can use the Chr function to display special characters. In that case, your expression would look something like this:
In this expression, replace val with the ASCII value of the character you want to display. If you don't get the bar you want with a proportional font such as Arial, try setting the Font property for the text box to a monospaced font such as Courier.
Of course, if your values are too large, you won't be able to depict them graphically without scaling them down. For values that are multiples of 1,000, you can use an expression like this:
This expression will use the integer that results from the division by 1,000 to generate the elements of the horizontal bar.
What do you think of this article format?
Our editors are developing and refining new methods and formats for delivering the solutions you need. Do shorter, step-by-step pieces such as this one help you overcome the IT problems that keep you up at night? Share your thoughts with our editors, and you could win a free TechRepublic book or CD of your choice. Content for this article was derived from the TechRepublic Microsoft Office e-newsletter. You can have tips like this delivered via e-mail each week by signing up here.