Control Fore Color (1 Viewer)

Juolupuki

Registered User.
Local time
Today, 08:27
Joined
Jan 3, 2018
Messages
31
Hi all,

Having difficulty to understand why in same form multiple control with same fore color code doesn't apply when you navigate in the form (see attached). I would like to have the same color as #43494D or in RGB (67,73,77).

I have tried to recreate manually or with format painter - no luck.

Anyone had the same issue?

Thank you!
 

Attachments

  • ForeColorDiferent.JPG
    ForeColorDiferent.JPG
    31.7 KB · Views: 94

Minty

AWF VIP
Local time
Today, 08:27
Joined
Jul 26, 2013
Messages
10,355
That looks like the control is disabled at the time of the capture, that will "dim" the colour.
 

Juolupuki

Registered User.
Local time
Today, 08:27
Joined
Jan 3, 2018
Messages
31
That looks like the control is disabled at the time of the capture, that will "dim" the colour.

That a dim color i do want and its keep black default one :(
 

Minty

AWF VIP
Local time
Today, 08:27
Joined
Jul 26, 2013
Messages
10,355
Don't disable the control then , simply lock it. By default a disabled control is dimmed out to obviously prevent it being used.

The other route is for you to grey out the background but keep the fore colour set as you want it and lock the control. Then revert to the normal colours when you unlock the control. You can also remove the tab stop to "encourage" its avoidance.
 

Juolupuki

Registered User.
Local time
Today, 08:27
Joined
Jan 3, 2018
Messages
31
Don't disable the control then , simply lock it. By default a disabled control is dimmed out to obviously prevent it being used.

The other route is for you to grey out the background but keep the fore colour set as you want it and lock the control. Then revert to the normal colours when you unlock the control. You can also remove the tab stop to "encourage" its avoidance.

The textboxs are not disabled they can be used in any direction i mean the record can be selected from the list box or it can be used to edit add new record. i have attached the screen shots, txtbox and list box setings they are exactly the same.
 

Attachments

  • ForeColorSettings1.JPG
    ForeColorSettings1.JPG
    47.7 KB · Views: 89
  • ForeColorSettings2.JPG
    ForeColorSettings2.JPG
    79.7 KB · Views: 77
  • ForeColorSettingslstBox1.JPG
    ForeColorSettingslstBox1.JPG
    54.2 KB · Views: 65
  • ForeColorSettingslstBox2.JPG
    ForeColorSettingslstBox2.JPG
    78.5 KB · Views: 77

Minty

AWF VIP
Local time
Today, 08:27
Joined
Jul 26, 2013
Messages
10,355
Okay, that is a bit weird.

It maybe something to do with the fact that they are combo boxes or list boxes, but I can't remember having that problem personally.

Have you tried creating a new simple form and setting those colours - in case it's some type of corruption on the form?
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 08:27
Joined
Sep 12, 2006
Messages
15,614
The dim colour is caused by setting a control to enabled=no and locked=no

It's hard to work out exactly what colours are used by windows/access. It's also possible that the colours will change depending on the theme you use.

I use dimmed controls, but I also tend to use a background colour of yellow, or pale yellow to give a quick visual clue for non-editable controls. Yellow always seem to display in a user- friendly manner - while red, blue and green don't always.
 

Juolupuki

Registered User.
Local time
Today, 08:27
Joined
Jan 3, 2018
Messages
31
The dim colour is caused by setting a control to enabled=no and locked=no

It's hard to work out exactly what colours are used by windows/access. It's also possible that the colours will change depending on the theme you use.

I use dimmed controls, but I also tend to use a background colour of yellow, or pale yellow to give a quick visual clue for non-editable controls. Yellow always seem to display in a user- friendly manner - while red, blue and green don't always.

I could understand if they all be with black fore color, but in this case some black font some of it grey - what i exactly want :banghead:
All controls has Enable = Yes and Locked = No. All setting are same for every control.
 

Attachments

  • ForeColorSettingslstBox3.JPG
    ForeColorSettingslstBox3.JPG
    27 KB · Views: 59

Minty

AWF VIP
Local time
Today, 08:27
Joined
Jul 26, 2013
Messages
10,355
Can you upload the database with just the form you are having issues with and maybe enough dummy data for the form to work ?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 03:27
Joined
Feb 28, 2001
Messages
27,001
It's also possible that the colours will change depending on the theme you use.

Dave, that "system theme" situation is actually signaled by a specific set of numbers that can't be true "RGB" colors. I.e. if vbWhite is &H00FFFFFF, which is the "whitest" positive integer with maximum R, B, and G; then the system values are all NEGATIVE integers. Window text would be &H80000008; a button face would be &H8000000F, and 27 more such constants exist. Use object browser to find the SystemColorConstants if you are curious. You can also use those constants symbolically when using dynamic controls with VBA because (I believe) they are part of the default Windows library.

As to why the examples are showing slightly different Forecolors for a couple of boxes? That's not clear to me. But it is definitely NOT due to the control being disabled. That status would also affect the Backcolor and Bordercolor settings, which does not seem to be happening for the oddball cases in the screen shots. ALL of those items would be dimmed (actually, have more "white" in them), particularly since Juolupuki has chosen a "sunken" edge effect. The "disabled" state would stand out like a sore thumb.

I'm with Minty's later suggestion - a subtle effect of corruption. Does a Compact & Repair change the colors at all? (If so, then Minty's guess was right.)
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 08:27
Joined
Sep 12, 2006
Messages
15,614
I am sure you are right, Doc Man. I am struggling to see the difference to be honest. All the foreground colours look about the same to me in the last screen shot, although some might be black and others dark grey. A dimmed control is mid grey on a light grey I think.
 

Juolupuki

Registered User.
Local time
Today, 08:27
Joined
Jan 3, 2018
Messages
31
Hi,
Apologies for so late respond. I have attached a peace of the actual database I'm working right now. Maybe it will make more clearer.

I can tell that I'm not an expert of MS Access (self learner) so please don't judge much :), I'm trying my best.

Thanks
 

Attachments

  • Example.accdb
    1.6 MB · Views: 68

isladogs

MVP / VIP
Local time
Today, 08:27
Joined
Jan 14, 2017
Messages
18,186
I've seen this problem before in a thread from a few months ago and we found the solution to the issue at that time.
Later today, I'll search for it & post back if nobody has got there first

I think part of it is to do with setting the initial focus to the combo & also using .dropdown code ...but it may also be due to various security features you've added

In the meantime, could you help us to help you.
Repost a much less locked down version of this to make it easier to work on. Add frm_Admin as the startup form.
Allow full menus, remove popup/modal properties & disable all the code used to block various keyboard entries ... etc.
 

Juolupuki

Registered User.
Local time
Today, 08:27
Joined
Jan 3, 2018
Messages
31
ok i think i cleaned as much i could and menu can be seen too.
 

Attachments

  • Example.accdb
    1.6 MB · Views: 63

isladogs

MVP / VIP
Local time
Today, 08:27
Joined
Jan 14, 2017
Messages
18,186
I didn't find the previous example & I'm not sure I've fixed it in the same way

The way your combo has been setup on the 2nd & 3rd tabs, you have a Henry Ford Model T situation: You can have any colour you like as long as its BLACK

The problem with your combo is that the bound column is NOT the primary key field. If you change it to use the primary key field, you can have any forecolor of your choice

NOTE: Your tblBuisnessUnit is incorrectly spelt.
It has a totally unnecessary ID field that's not the PK field
EITHER delete the field (preferred) or make it the PK.
To save time & effort here I've made it the PK field

Now when you use your form, the combo forecolor is mid grey

You asked that we "don't judge much" so I'll just say there are many things that could be improved. Here's one:

Use Me. notation for referring to controls in the same form
For example, in the subform frm_AddDepartment, instead of writing this:
Code:
Forms!frm_Admin!frm_AdminSetUpData_Sub!frm_AddDepartment.Form.lstDepartments.Requery
you can write this:
Code:
Me.lstDepartments.Requery

There are MANY similar examples you should adjust in the same way.
Much quicker to write. Easier for both you & Access to understand.
 

Attachments

  • Example_FIXED.zip
    533.4 KB · Views: 64
Last edited:

Juolupuki

Registered User.
Local time
Today, 08:27
Joined
Jan 3, 2018
Messages
31
OK i have tried on the my original version it is still the same in the second, 3rd tab drop down has black color.
Can be because the back end tables are just linked to front end or still to do with PKs? Example version worked in first go if i change the key.

Thanks a lot for tips :)

Just to understand reference to controls. I have been using same format because i have trouble with vlookup, DCount functions in VBA it doesn't understands the Me. notation so was need it to point full path to control :).
Is there is a bit different format for functions with Me. notation?
 

Gasman

Enthusiastic Amateur
Local time
Today, 08:27
Joined
Sep 21, 2011
Messages
14,050
Me only works for code in a form.?
 

Minty

AWF VIP
Local time
Today, 08:27
Joined
Jul 26, 2013
Messages
10,355
Me. references the current form object, which is why Me.Parent is able to refer to the main form when used in a sub form. That's why you can't use it in a query as the query has no idea what the current form is.

One of the main benefits is that intellisense kicks in when you type Me. and will allow you to autocomplete the correct control names available on the form your are working on (in the VBA editor).
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 04:27
Joined
May 21, 2018
Messages
8,463
The issue with the Dlookup is that you hardwire it. Your Where clause would look like

Code:
"Userid = " & me.UserID
instead of 
"UserID = Forms!frm_Admin!frm_AdminSetUpData_Sub!frm_AddDepartment.Form.UserID"
Instead of passing the query the form reference string you pass the query the value. Instead of the query referencing the form it is passed the answer
UserID = 123
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 04:27
Joined
May 21, 2018
Messages
8,463
Note. If you resolve it this way ahead of time you need to handle text as
Code:
"UserName = '"& Me.UserName & "'"
That way you are passing a string surrounded by single quotes
Code:
UserName = 'Smith'
 

Users who are viewing this thread

Top Bottom