white text appearance when control is clicked

R

Ruth

Working with Access 2003 and XP. I have a white form with a dark
colored header. I placed a transparent control (with the company name)
in the header and formatted the text to be white. It looks great, but
I want users to be able to click in the control to execute a search
function on the organization name. When you click in the control, you
get white text on a white background. Even after searching, the cursor
stays in the field and you can't see the company name.

Is there anyway to turn the background of the activated control to any
other color than white?

Thanks,
Ruth
 
M

Mr. B

Working with Access 2003 and XP. I have a white form with a dark
colored header. I placed a transparent control (with the company name)
in the header and formatted the text to be white. It looks great, but
I want users to be able to click in the control to execute a search
function on the organization name. When you click in the control, you
get white text on a white background. Even after searching, the cursor
stays in the field and you can't see the company name.

Is there anyway to turn the background of the activated control to any
other color than white?

Thanks,
Ruth

Ruth,

The simple answer to your question is, "Yes".

You will need to use VBA code in two seperate events for each control
that you wish to change the back color.

Place the following line of code in the "Got Focus" event of your
control:

Me.txtBox1.BackColor = 16711680

This line would turn the back color of the active control to blue when
it receives the focus.

If you wanted to make the back color red, the number would be 255.
You can use any valid number you want.

Then place the following line of code in the "Lost Focus" event of the
same control:

Me.txtBox1.BackColor = 16777215

This line would cause the back color to be reset to the default back
color of an Access control.

If you already have a color devined as the back color for your
control, just go to the property dialog box and copy the number for
the color you have specified and replace the "16777215" that I have
used with the number for your control.

HTH

Mr B
 
R

Ruth

Ruth,

The simple answer to your question is, "Yes".

You will need to use VBA code in two seperate events for each control
that you wish to change the back color.

Place the following line of code in the "Got Focus" event of your
control:

Me.txtBox1.BackColor = 16711680

This line would turn the back color of the active control to blue when
it receives the focus.

If you wanted to make the back color red, the number would be 255.
You can use any valid number you want.

Then place the following line of code in the "Lost Focus" event of the
same control:

Me.txtBox1.BackColor = 16777215

This line would cause the back color to be reset to the default back
color of an Access control.

If you already have a color devined as the back color for your
control, just go to the property dialog box and copy the number for
the color you have specified and replace the "16777215" that I have
used with the number for your control.

HTH

Mr B

Mr. B, You ROCK! Thanks so much! Exactly what I wanted.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top