?
Solved

Setting background color to specified value

Posted on 2014-02-21
15
Medium Priority
?
325 Views
Last Modified: 2014-02-21
Me.lblSigned.BackColor = "#2EB03D" 'vbGreen
        Me.lblSigned.ForeColor = lngblack
        Me.lblSigned.Caption = "SIGNED"
        Me.Sub1.Enabled = True

i would like to specify the actual color value - what is the proper syntax?

 Me.lblSigned.BackColor = "#2EB03D"??????
0
Comment
Question by:Karen Schaefer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 3
  • +1
15 Comments
 
LVL 29

Expert Comment

by:IrogSinta
ID: 39878254
You need to use the RGB equivalent or the long value used by Access for that color.  In this case you can use either:
Me.lblSigned.BackColor = RGB(46, 176, 61)
Me.lblSigned.BackColor = 3059773

Ron
0
 
LVL 85
ID: 39878256
What do you mean the "actual color value"? If you want to set it to vbGreen, then you use that:

Me.lblSigned.BackColor = vbGreen
0
 
LVL 75
ID: 39878257
I was trying to do that the other day ... with no luck. BUT ... I have got to believe ... there is a way, since Access now supports the hex format in the property sheet ....

mx
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 29

Expert Comment

by:IrogSinta
ID: 39878265
In addition, you would use vbBlack instead of lngBlack. Valid color constants are
vbBlack
vbRed
vbGreen
vbYellow
vbBlue
vbMagenta
vbCyan
vbWhite
0
 
LVL 75
ID: 39878283
Of course, if you want some other of the millions of colors ....
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 39878295
As I posted earlier, for custom colors, you would use the RGB equivalent or the long value used by Access; however, Mx, I'm inclined to agree with you that there should be a way to use the Hex value instead but I haven't come across a way to do that either.

Ron
0
 

Author Comment

by:Karen Schaefer
ID: 39878307
I know but the color of green is to harsh - so I was hoping to be able to select from the color wheel the specified color - or is there a way to get the RGB equivalent of the specific color value.
0
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 2000 total points
ID: 39878310
Using the Windows Calculator ... you can see that ... ironically

the Decimal value of Hex 2EB03D is ... .... ....

3059773

!
0
 
LVL 75
ID: 39878323
Here we go !!

Val("&H" + "2EB03D") = 3059773

Finally !!!

Me.lblSigned.BackColor = Val("&H" + "2EB03D")

mx
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 2000 total points
ID: 39878332
"i would like to specify the actual color value - what is the proper syntax?"

Me.lblSigned.BackColor = Val("&H" + "2EB03D")
0
 
LVL 75
ID: 39878349
Me.lblSigned.BackColor = Val("&H" + "InsertYourHexValueHere")
0
 

Author Comment

by:Karen Schaefer
ID: 39878362
Ok found a Hex to RGB converted and that did the trick.
0
 

Author Closing Comment

by:Karen Schaefer
ID: 39878366
thanks for the input.
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 39878404
That's pretty good, mx. And you can even simply write it as:
Me.lblSigned.BackColor = Val("&h2EB03D")
Incidentally, just for information sake, each 2 characters of the hex color value represents Red, Green, and Blue respectively. So
2E ==>  2 x 16 + 14 = 46   (E is 14 in decimal with A representing 10, B is 11, etc.)
B0 ==> 11 x 16 + 0 = 176   (B is 11)
3D ==>  3 x 16 + 13 = 61   (D is 13)

RGB(46, 176, 61)

Open in new window

0
 
LVL 75
ID: 39878434
:-)
"And you can even simply write it as:"
Well sure. I wrote it the other way for clarity ...
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question