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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Syntax 1

Status
Not open for further replies.

armstrong722

Technical User
Feb 26, 2002
32
0
0
US
I have a form that is made of 3 forms from 3 tables.

I want to changed the background color of one of them if there is a check box checked off.

I can't seem to find the correct syntax for changing the forms color based on the this check box. Also when the records are changed or just looked at one at a time.

I have tried code and macros with no success.

 
Private Sub Form_Current()
If YesOrNo Then
Me.Section("Detail").BackColor = 16711808
Else
Me.Section("Detail").BackColor = -2147483633
End If
End Sub

This is only if all of your form is on the detail section, if your form is also on the header or footer, you will have to change the colors of those, too.

This sample code turns the background purple if yesorNo is true and grey if false.
 
Quick question.

I can't find the keyword me anywhere in the online documentation.

Where is it?
 
Me is whichever form you are currently in. You can only use it for the code in the forms own class module. Me also works for Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top