teiben
08-20-2003, 11:45 AM
I'm using the following in a report. Which works only if I don't have the control source set to a query. There are a ton of records so I wanted this to work from a parameter query but it doesn't ...any ideas!
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.DateRecd = DMax("[DateRecd]", "MathData") Then
Me.DateRecd.FontBold = True
Me.DateRecd.ForeColor = vbRed
Else
Me.DateRecd.FontBold = False
Me.DateRecd.ForeColor = vbBlack
End If
End Sub
SforSoftware
08-20-2003, 01:27 PM
Teiben,
I should think to declare a Variable at module-level where you store the DMax-value (ie in the Report_Open event).
In Detail_Format you can refer to that variable and don't have to take the DMax for each record (what's very slow).
further: is 'DateRecd' the name of the control? Do you have also a field in the recordsource with that name? Then rename the control to ie 'txtDateRecd'
Succes,
Bert
teiben
08-21-2003, 04:56 AM
Bert
DateRecd is the the field name as well as the textbox on the report.
I tried the module thing, (not sure if I did correctly), becuase it doesn't work with the parameter query.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim daterecd As Date
If Me.daterecd = DMax("[DateRecd]", "MathData") Then
Me.daterecd.FontBold = True
Me.daterecd.ForeColor = vbRed
Else
Me.daterecd.FontBold = False
Me.daterecd.ForeColor = vbBlack
End If
End Sub
Change the name of daterecd to something like txtDaterecd and get rid of the DMax as suggested, it'll slow your report down