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

Report label to change color

Status
Not open for further replies.

jw5107

Technical User
Jan 20, 2004
294
US
I have an unbound report. The data for the textboxes on the report come from a form that is opened. Like: Forms!ProMap!IID. This works fine. The same form (ProMap) also has labels that change color based on code behind the form.
My question is: If I can get the textboxes on the report to look at the textboxes on the form, how can I get the labels on the report to match the same colors as labels on the form? Is there a way to do this without creating extra queries for the report?

Any suggestions or examples??
Thanks in advance!!
jw5107
 
Perhaps:
Code:
Private Sub Report_Open(Cancel As Integer)
Dim ctl As Control
For Each ctl In Me.Controls
  If ctl.ControlType = 100 Then
    ctl.BackColor = [Forms]![ProMap].Controls(ctl.Name).BackColor
    ctl.ForeColor = [Forms]![ProMap].Controls(ctl.Name).ForeColor
  End If
Next
End Sub
 
remou,
Thanks for the response!!
A couple of questions/concerns -- I think I understand your example...
If I got it right, I will have to create a line of code for each control(labels in this case) on the form. There are a BUNCH of labels on the form & the same amount on the report. Would there be a way to loop thru the forms labels and the match the same named labels on the report?
I think this would be the huckleberry - just don't know exactly how to do loops?????????
Also - what is ctl.ControType "100"?
I will test our your example when I return to work!!
Thanks again!!
jw
 
jw,
Isn't this the same question as your other thread? Two threads with the same question is a no-no. If this is the same question, please refer respondents to one or the other thread.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
The snippet loops. It assumes that the reports labels match the form labels.
 
To All:

Future responses should be posted at: thread703-1158810

Sorry for the confusion.
jw5107
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top