422,946 Members | 1,141 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 422,946 IT Pros & Developers. It's quick & easy.

MS access - cannot get bar chart series to be orange color

P: 1
Ms access graph. Cannot get orange in bar chart for a series. Believe this is due to the palette. Trying to determine how in code to fix this. It appears to be approx. the RGB values passed to the series when this is set. Comes out fine as table background... however, in chart... brown, green, purple... depends on shade of orange.
Apr 16 '18 #1
Share this Question
Share on Google+
1 Reply


zmbd
Expert Mod 5K+
P: 5,104
Sac3244,
Looks like your question was lost in the shuffle.

The Graph object in Access has a few things that are not obvious to the VBA editor so a bit of hunt and peck.

First is the RGB value for orange:
Google search rgb(255,165,0)= 42495

Next is a bit knowledge from MS-Excel charts so I guessed a bit at how the graph object worked in MS-Access...

Creating a table such that:
ID (auto), Series1 (Long), Series2 (Long)
Just added a few random numbers

Created a form based on the above data.
Added a graph control and named it "ctrl_graph"
Added a command button and named it "ctrl_btn"

Added an on_click event to ctrl_btn
Expand|Select|Wrap|Line Numbers
  1. Private Sub ctrl_btn_Click()
  2.   Me.ctrl_Graph.seriescollection(1).interior.Color = 42495
  3. End Sub
This changed the default color from blue to the orange for "Series 2" (second bar on the graph) so it appears that the index for the seriescollection is zero based.

>Noticed that once the series color was changed via code, that closing and reopening the form and database did NOT reset the color to the default despite the fact that I did NOT save the change.

Hope that sets you in the proper direction.

-Z
1 Week Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.