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

Can appearance conditions be set on Access Report lables?

Status
Not open for further replies.

Mike555

Technical User
Feb 21, 2003
1,200
US
Can an appearance condition be set on an Access Report label? For example - The label only appears if one of the db fields = 'ABC'? The label should not point to a control source of its own in the database table.

Let me know if this does not make sense.


Thanks,
Mike Mason, MCSA
 
I do not believe that you can edit a label in run time on an Access report. I always use unbound text boxes instead. They work just as well and have more flexability. ex:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If (Me.txtDueDate < Now) Or (Me.txtDueDate = &quot;&quot;) Or (IsNull(Me.txtDueDate)) Then
Me.txtDueDate.FontWeight = 700
Me.txtDueDate.ForeColor = RGB(255, 0, 0)
Me.txtLate = &quot;Late&quot;
Else
Me.txtDueDate.FontWeight = 400
Me.txtDueDate.ForeColor = RGB(0, 0, 0)
Me.txtLate = &quot;&quot;
End If

End Sub

where I want the &quot;Label&quot; Late to show next to any record past its due date.

I hope this helps

BAKEMAN [pimp]
 
Bakeman...I've used your code, but it appears that I'm missing something because it will not run. Below is the code. I'm trying to setup so that if Group ID = &quot;CST&quot;, then txtFormat (the unbound text box) will display 'CD', else displaying 'Diskette'. Thanks for your help


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If Me.Group ID = &quot;CST&quot; Then
Me.txtFormat.FontWeight = 700
Me.txtFormat.ForeColor = RGB(255, 0, 0)
Me.txtFormat = &quot;CD&quot;
Else
Me.txtFormat.FontWeight = 700
Me.txtFormat.ForeColor = RGB(255, 0, 0)
Me.txtFormat = &quot;Diskette&quot;
End If

End Sub
 
Is Group ID bound to a control on the Report? If so try referring to the control name. If not place it on the report (hidden if necessary) and refer to the control name.

Let me know if this works.

BAKEMAN [pimp]
 
Hi, You might want to try something like this:
Create a label next to GroupID. Name it something like lblCaption. Leave the caption blank. Then change the label caption based on GroupID:

Select Case me.GroupID
Case is = &quot;CD&quot;
Me.lblCaption.FontWeight = 700
Me.lblCaption.ForeColor = 255
me.lblCaption.Caption = &quot;CD&quot;

Case is = &quot;CST&quot;
Me.lblCaption.FontWeight = 700
Me.lblCaption.ForeColor = 255
me.lblCaption.Caption = &quot;Diskette&quot;

Case Else: Me.lblCaption.FontWeight 'YourFontWeight Me.lblCaption.ForeColor = 'YourForeColor
Me.lblCaption.Caption = &quot;&quot;

End Select

You can use If statements to accomplish the same thing.
 
Bakeman...Let me know if I've answered your question correctly here -

GroupID points to a control source in a table. The contents of the GroupID field in the table will appear on the report where the GroupID is displayed. So in essence
the control is in the table, not the report.

Pdldavis...Does this make a difference in the code you've given me?
 
Sorry about the late response - on vacation.
No, shouldn't make any difference. You are simply changing the caption, colors and font size of the label depending on your groupID. Labels are great for these kinds of circumstances.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top