Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 10-12-2017, 11:08 AM   #1
chrisjames25
Newly Registered User
 
Join Date: Dec 2014
Posts: 261
Thanks: 3
Thanked 1 Time in 1 Post
chrisjames25 is on a distinguished road
Color queries in Form

HI

Week ago PBaldy and Gasman helped me adapt an allen brown code to change back color of textboxes as i tab through them.

Works like a charm. Question is the code references the colour liek this

Code:
Private Const mlngcFocusBackColor = &HB0FFFF
I know how to change colours using rgb(,,,) but no clue how to find a colour i like and then write it like this. Any help explaining this would be great.

Cheers

chrisjames25 is offline   Reply With Quote
Old 10-12-2017, 12:20 PM   #2
MarkK
Super Moderator
 
MarkK's Avatar
 
Join Date: Mar 2004
Location: Vancouver BC
Posts: 7,671
Thanks: 10
Thanked 1,265 Times in 1,204 Posts
MarkK is a name known to all MarkK is a name known to all MarkK is a name known to all MarkK is a name known to all MarkK is a name known to all MarkK is a name known to all
Here's what I do. There is probably a faster way.
  1. Create a new Form1.
  2. Add a new textbox Text0.
  3. Still in design view, open the property sheet for Text0 and find the BackColor property on the Format tab.
  4. Click on the ellipsis (...) at the far right of BackColor property row, which opens a fancy color palette selector tool.
  5. Pick a color. This now becomes the background color of the control. In later versions of Access, however, this is no longer the actual long integer code. Maybe you get a reversed hex notation (#BBGGRR), or a text description like "Background 1, Darker 35%"
  6. To get the actual number, write code like...
    Code:
    Private Sub Text0_DblClick(Cancel As Integer)
        Debug.Print Me.Text0.BackColor
    End Sub
    ...which writes the actual value to the immediate pane. See how that works?
  7. Copy that number to your constant...
    Code:
    Private Const mlngcFocusBackColor = 11599871
  8. Circuitous, but, done!
hth
Mark
__________________
formerly known as lagbolt | Windows 10 | Access 2010 | Visual Studio 2013 | "Institutions have a vested interest in perpetuating the problems to which they are the solution." - Clay Shirky
MarkK is offline   Reply With Quote
Old 10-12-2017, 01:59 PM   #3
Mark_
Longboard on the internet
 
Join Date: Sep 2017
Location: Not the middle of no where, but I can see the road to it from my house.
Posts: 1,386
Thanks: 14
Thanked 257 Times in 255 Posts
Mark_ will become famous soon enough
Re: Color queries in Form

Possibly a little easier way to accomplish the same;
Create a new blank form.
Add 4 Text boxes to it (TxtR, TxtG, TxtB, TxtCV).
In the after accept for each of the fields, add the following:

Code:
    Me.Detail.BackColor = RGB(TxtR, TxtG, TxtB)
    Me.TxtCV = "Colour Value = " & Me.Detail.BackColor
As you change values, your TxtCV will update to show the current value. Nice part is you can see the rest of the screen clearly to see just what colour it changes to. Toss on other fields / captions as needed to see how they will look on the background.

Mark_ is offline   Reply With Quote
Old 10-12-2017, 06:51 PM   #4
Galaxiom
Super Moderator
 
Join Date: Jan 2009
Location: NSW Australia
Posts: 11,178
Thanks: 68
Thanked 1,388 Times in 1,309 Posts
Galaxiom is a splendid one to behold Galaxiom is a splendid one to behold Galaxiom is a splendid one to behold Galaxiom is a splendid one to behold Galaxiom is a splendid one to behold Galaxiom is a splendid one to behold
Re: Color queries in Form

This little open source freeware program called WhatColor shows a tool tip with the RGB values of the pixel under the cursor.

It is one of dozens of simple utilities written using the AutoHotKey scripting language.
Galaxiom is offline   Reply With Quote
Old 10-13-2017, 08:48 AM   #5
ridders
Part time moderator
 
ridders's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 5,797
Thanks: 79
Thanked 1,426 Times in 1,331 Posts
ridders is just really nice ridders is just really nice ridders is just really nice ridders is just really nice
Re: Color queries in Form

I use a modified version of a colour converter utility by Daniel Pineault which is available here: https://www.devhut.net/2010/11/17/ms...sample-colors/


Attached Images
File Type: png ColourConverter.PNG (19.2 KB, 178 views)
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

New example databases:

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

-----------------------------------------------------------------------------------
nil illegitimi carborundum est
ridders is offline   Reply With Quote
Old 10-14-2017, 08:10 AM   #6
arnelgp
Registered User
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 6,339
Thanks: 54
Thanked 2,027 Times in 1,940 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Color queries in Form

Something to play with color.
Attached Files
File Type: zip aaWebSafeColor.zip (43.0 KB, 28 views)

__________________
"Never stop learning, because life never stops teaching"
arnelgp is online now   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Text box bg color in continuous form: the color being the value of the text box pma74 Forms 1 07-13-2013 06:14 AM
Color of field switches to main form color unexpectedly chickadee Forms 6 05-19-2010 08:50 AM
Form Area Color Changes AlphaZeroX Forms 2 12-19-2006 06:18 AM
Sort by color then count of color.. robbie9 Queries 2 01-07-2003 06:49 AM
Color a Form Grandchester Reports 1 05-08-2002 02:09 PM




All times are GMT -8. The time now is 05:02 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World