Access Developer 40
Conditional Formatting VBA, Color & Font Pickers
Today's class is going to be focusing on changing Conditional Formatting using VBA. Now this might not sound very impressive, but you can have your user set up custom color schemes for things like forms and reports. We'll learn how to work with the Windows Color Picker dialog, where you can click a button, it'll open up the color palette. You can select the color and save that in your table. And we'll learn how to work with the Windows Font dialog box as well. We're going to build a countdown timer form, which shows you how many days you have left until certain events are coming up.
In Lesson 1, we're going to build an event countdown form. So if you've got some events coming up, conferences, beach day, some surgery, whatever this will pop up whenever your database loads to remind you, "Hey, you got this conference coming up tomorrow." Or "you have to go to the beach in four days." We'll create the display form, a little conditional formatting for events that are coming up soon. One day is red, less than five days will be yellow. We'll make buttons to add, edit, or delete events using code. We'll make a little form to edit those events, to pop up form.
In Lesson 2, we're continuing on with our event countdown form. We're going to add some conditional formatting. We're going to let the user pick a color scheme so they can choose red, blue, black, green, and that will be applied for each of the events.
In Lesson 3, we're going to build a custom color editor. It's a form to edit our color scheme. We'll learn how to work with hex and RGB values and then convert between them and to use the windows color dialog. So the user can select the color and then save it in our color scheme form.
In Lesson 4, we're going to begin working with the conditional formatting VBA code. We'll learn about the FormatCondition, object, the FormatConditions collection, how to delete and add them. We'll determine the maximum number of conditional formatting items that you can have. Then we'll count the records in the current form, so we don't add too many of them and generate errors. And I'll show you how to do that with something other than DCount.
In Lesson 5, we are continuing with the conditional formatting VBA. We'll add the additional controls on the form to the conditional formatting loop. That number box, the background box. We will add some code to open up a window to the right of another form. So for example, we always want the event countdown form opening up to the right of the main menu form, no matter where it is. Then we'll refresh events from the color form. So you got the color form open. You refresh that it'll close and reopen the event countdown form. So you can see the updates in real time. And then we're going to see some updates to the color picker and the RGB and hex functions. And we'll explore those in the code vault.
In Lesson 6, we're going to learn about user defined types. We'll learn about what user defined types are in VBA, how to define them, and how to pass a variable around that is a user defined type and how it always uses ByRef.
In Lesson 7, we're going to learn how to use the Windows Font Dialog so that we can change fonts at runtime. The user can pick the font for the event and for the days left. You can use the same technique to pick the font on a report, for example. We'll learn how to save those changes in a settings table and then load them back up when the form loads
In Lesson 8, we're going to apply the font stuff that we learned in lesson seven and apply it to our letter writer. So we'll be able to specify a custom font for each letter. Each letter can have a different font if you want. You can save that in the letters settings in its record. And there are some issues when applying these fonts to reports, we'll cover that in lesson 8.
Enroll now so that you watch these lessons, learn with us, post questions, and more!
Please feel free to post your questions or comments below. If you are not sure as to whether or not this product will meet your needs, I'd rather help you before you buy it. Remember, all sales are final. Thank you.
microsoft access, access 2016, access 2019, access 2021, access 365, ms access, #msaccess, #microsoftaccess, #help, #howto, #tutorial, #instruction, #learn, #lesson, #training, #database, event countdown, conditional formatting vba, hextorgb, rgbtohex, formatconditions, recordcount, user defined type, byref, font dialog, color picker
Subscribe to Access Developer 40
Get notifications when this page is updated
Check out these other pages that may be of interest to you: