Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change forecolor of form when got focus 1

Status
Not open for further replies.

fredk

Technical User
Jul 26, 2001
708
US
I have a form with a sub-form - how do I make the background color different for the form that has focus?

I realize I probably need to use the got "on got focus" and "on lost focus" but I am having a hard time figuring out the code ?

Any help would be greatly appreciated!!!

Thanks!!

Fred
 
In your GotFocus Event you need something like:

Forms!MyFormName.Section(0).BackColor = MyColour

Rename MyFormName to the name of your form and MyColour to the colour you want and it should work I believe.
 
I tried it but it is not working - I have:

Forms!frmgroups.Section(0).BackColor = 255

I tried to change the section number also - it is the detail section I am trying to change.

Thanks!!

Fred
 
Hi, Fred:

Here's a good link for form/subform referencing:


Also, if you don't want to use the numerical index for the section on which you're changing the backcolor, you can refer to it by name:
Code:
Forms!MyFormName.Section([blue]"Detail"[/blue]).BackColor
HTH,

Ken S.
 
Perfect - thanks Ken!!!!

Fred
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top