View Full Version : Changing field colors with focus.


Talismanic
07-20-2001, 11:05 AM
One of the form wizards that Access makes has a yellow background with yellow fields. When any field gets focus it turns white, I am trying to do the same thing in my form, anybody have an idea how it is done.

I know that I could do it with code but there is no code included with their forms so it must be possible to do it without the code.

Talismanic
07-20-2001, 11:34 AM
I found this this thread, Topic: change color of only current text field or its prompt (http://www.access-programmers.co.uk/ubb/Forum1/HTML/002869.html)?

Cut and paste from the above thread:

Mike Gurman
Member

You're going to laugh your head off when you hear this:

We've been trying to use a sledgehammer to crack a walnut; all you need to do is:
-set the text box BackColor to whatever colour you want the highlight to be
-set the BackStyle to transparent
-create a 'box' object, make it the same size as the text box, change the border and colour settings so that they look OK and place it BEHIND the text box.

This way, you get to see through the text box background to a plain white box (or whatever), but when the text box receives the focus, it's transparent property is temporarily suspended (Access does this automatically) and the colour comes back.

End Cut and Paste

I just tried it and it works great. The description above actualy makes it sound a little more complicated then it is. Thanks Mike for the answer http://www.access-programmers.co.uk/ubb/smile.gif

[This message has been edited by Talismanic (edited 07-20-2001).]

aqif
07-21-2001, 02:11 AM
Hi All http://www.access-programmers.co.uk/ubb/smile.gif

I've also got a unique method which has never made sense to me but it worked changing the current control color. You need to do following steps.

1. Fist give background and fore ground Color to text box that color which u want to see as active item background & fore ground color. eg. dark blue & white

2. Now make every item backgroundcolor porperty as transparent. Unfortunately this thing only work with transparent items. U can set ur form color whatever u like.

3. goto click event of first textbox n write
Me.AllowAdditions = True

I dont know but it then starts working liek a charm http://www.access-programmers.co.uk/ubb/smile.gif Enjoy

Cheers!
Aqif