Bound Object Frame Control, Chart Control, Command Button Control, Form, Report, Toggle Button Control, Unbound Object Frame Control.
You can use the ObjectPalette property with the PaintPalette property to specify which palette is used by the application to create:
Microsoft Access uses a String data type in the ObjectPalette property to set the value of the PaintPalette property for a form or report.
For the following objects, views, and controls, the Object Palette property setting is read-only.
Object |
View |
Control |
Forms |
Design view and Form view |
Command button, chart, toggle button, and unbound object frame |
Form view |
Bound object frame | |
Reports |
Design view |
Command button, chart, toggle button, and unbound object frame |
You can use this property only in a macro or Visual Basic.
The setting of the ObjectPalette property makes the palette of the application associated with the OLE object available to the PaintPalette property of a form or report. For example, to make the palette used in Microsoft Graph available when you’re designing a form in Microsoft Access, you set the form’s PaintPalette property to the ObjectPalette value of an existing chart control.
Note Windows can have only one color palette active at a time. Microsoft Access allows you to have multiple graphics on a form, each using a different color palette. The PaletteSource property lets you specify which color palette a form should use when displaying graphics.
PaintPalette Property, PaletteSource Property, Picture Property.
The following example sets the PaintPalette property of the Seascape form to the ObjectPalette property of the Ocean control on the DisplayPictures form. (Ocean can be a bound object frame, command button, chart, toggle button, or unbound object frame.)
Forms![Seascape].PaintPalette = _ Forms![DisplayPictures]![Ocean].ObjectPalette
The ObjectPalette and PaintPalette properties are useful for programmatically altering the color palette in use by an open form at run time. A common use of these properties is to set the current form PaintPalette property to that of a graphic displayed in a control that has the focus.
For example, you can have a form with an ocean picture, showing many shades of blue, and a sunset picture, showing many shades of red. Since Windows only allows one color palette active at a time, one picture will look much better than the other. The following example uses a control’s Enter event for setting the form’s PaintPalette property to the control’s ObjectPalette property so the graphic that has the focus will have an optimal appearance.
Sub OceanPicture_Enter() Me.PaintPalette = Me![OceanPicture].ObjectPaletteSub SunsetPicture_Enter() Me.PaintPalette = Me![SunsetPicture].ObjectPaletteSub