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: 143
Thanks: 3
Thanked 0 Times in 0 Posts
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,141
Thanks: 8
Thanked 1,137 Times in 1,087 Posts
MarkK is a glorious beacon of light MarkK is a glorious beacon of light MarkK is a glorious beacon of light MarkK is a glorious beacon of light MarkK is a glorious beacon of light MarkK is a glorious beacon of light
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 online now   Reply With Quote
Old 10-12-2017, 01:59 PM   #3
Mark_
Newly Registered User
 
Join Date: Sep 2017
Posts: 118
Thanks: 1
Thanked 17 Times in 17 Posts
Mark_ is on a distinguished road
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: 10,794
Thanks: 58
Thanked 1,304 Times in 1,229 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
AWF VIP
Gold Supporter
 
ridders's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 2,063
Thanks: 37
Thanked 483 Times in 448 Posts
ridders will become famous soon enough ridders will become famous soon enough
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, 53 views)
__________________
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.
, Tapatalk


If this answer has helped, please click the Thanks button and/or click the 'reputation' scales symbol on the left and leave a comment. Cheers!
ridders is offline   Reply With Quote
Old 10-14-2017, 08:10 AM   #6
arnelgp
Newly Registered User
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 4,039
Thanks: 47
Thanked 1,367 Times in 1,295 Posts
arnelgp has a spectacular aura about arnelgp has a spectacular aura about arnelgp has a spectacular aura about
Re: Color queries in Form

Something to play with color.
Attached Files
File Type: zip aaWebSafeColor.zip (43.0 KB, 16 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 06:30 PM.


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 - 2017, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World