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!

On Format, On Print Question

Status
Not open for further replies.

rfhall3

Programmer
Feb 7, 2003
28
US
I am trying to bold certain records in a report, based on the value of a field. From what I can get out of HELP, I think I should be using the On Format Event Procedure in the Detail section. It does not matter whether the bolding applies to the entire line, or field by field. It may be that I am not using the correct combinations of . or ! or [].

Data for report: qryDummy Data
Data Fields in qry: FName
LName
BOLD (logical field)
(Note use of space in qry name and use of word BOLD for field name. Doable, but not smartest ways to do it!)

My Code:

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

If [qryDummy Code].[BOLD] = True Then
Report.FontBold = True
Else
Report.FontBold = False
End If

End Sub


Your help is greatly appreciated.

Bob Hall



 
First of all it needs to be in the On_Print Event. Secondly, it seems that each individual field has to be changed. There may be a simplier way of doing it, but this would work:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

If [qryDummy Code].[BOLD] = True Then
Me.FName.FontBold = True
Me.LName.FontBold = True
Else
Me.FName.FontBold = False
Me.LName.FontBold = False
End If

End Sub

Hope this helps,



TwoOdd
--------------
Good judgment comes from experience, and experience comes from bad judgment.
-- Barry LePatner
 
This can be done in the On Format event. You should bind a control (txtBold) to the field [Bold].
If Me.txtBold = True Then
Me.FName.FontBold = True
Me.LName.FontBold = True
Else
Me.FName.FontBold = False
Me.LName.FontBold = False
End If

Or

Me.FName.FontBold = Me.txtBold = True
Me.LName.FontBold = Me.txtBold = True



Duane
MS Access MVP
 
I stand corrected. It does work in the On Format event as well.

Thanks Duane!

TwoOdd
--------------
Good judgment comes from experience, and experience comes from bad judgment.
-- Barry LePatner
 
Thank y'all very much. It is finally working !!!

Bobby
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top