Learn how to draw rainbows on Access reports! Use them as indicators. Download the VBA code and sample database here:
Download:
https://msaccessgurus.com/VBA/Draw_Ra...
Report Draw Reference and VBA Syntax
https://msaccessgurus.com/VBA/ReportD...
The VBA code that does the drawing is all in one module that you can easily import into your projects. The Rainbow uses the Circle method. It's easy to call from code behind your reports.
00:02 ♫ Somewhere Over the Rainbow ♫
00:14 This Access database has 1 table, 2 reports, and a module with VBA code to draw a rainbow.
00:24 rpt_Rainbow_Page is unbound and draws a big rainbow at the top of the page.
00:32 rpt_Rainbow_Detail is based on the Status table and draws a rainbow, or portion of a rainbow on each record.
00:43 The Status table lists each status and the fraction of PI radians to start and end the rainbow.
00:52 0 radians is at 3 o'clock.
00:56 Angles increase counter-clockwise.
00:59 PI radians is at 9 o'clock.
01:04 There are 2*PI radians in a complete circle.
01:12 design view of the rainbow on a page
01:27 Event Procedure in the Page event
01:33 VBA code
02:05 Twips stands for TWenty In a Point, and is the default unit of measure.
02:12 ScaleWidth is the horizontal distance across the page.
02:17 ScaleHeight is the vertical distance from top to bottom of a page.
03:15 Y increases as you go down the page.
03:22 Now the Draw_Rainbow procedure is called, sending the report object, X, Y, and the radius.
03:36 global constant is defined for PI
03:49 global constant is defined for zero
04:07 array holding the colors of the rainbow and the background color
04:18 Draw_Rainbow_s4p procedure declaration
04:28 parameters
04:49 variables
05:03 setColorsRainbow procedure
05:19 9th color is the background color
05:52 DrawWidth, FillStyle
06:16 loop from the 1st to the 9th color
06:19 set FillColor and draw a circle
06:46 The beginning and ending angles are negative to indicate shape should be closed
07:04 decrease radius
07:29 Report that shows portions of a rainbow in the detail section based on values in a table.
08:11 1440 twips in an inch
09:05 beginning and ending angles
09:24 download sample database and the rainbow code
09:43 Access Training
09:46 Let's connect!
10:00 new year special
If you can imagine it, Access can do it.
Contact me for help with your Access projects.
kind regards,
crystal
Remote Training and Programming
Let's connect and team-develop your application together. I teach you how to do it yourself.
https://msaccessgurus.com