D
Dave
I have a report that has a cross tab query as its record source & that cross
tab will have heading. So I have the design of the report carried out
programmatically. My code is below to give you an idea iof what I have
done. However, at run time I need to have a field change color depending on
the result of the query.
My question is - Is there any way to, at design time call a function that
will eventually run at run time depending on the result from the query?
Code is
Public Function PrepareAdminReport() As Boolean
Dim ARecordset As DAO.Recordset
Dim AReport As Report
Dim i As Integer
Dim intNoOfCrossTabs As Integer
Dim AControl As Control
Set ARecordset = CurrentDb.OpenRecordset("qryCrossTab")
Set AReport = CreateReport("", "")
intNoOfFields = ARecordset.Fields.count - 1 'No of cross tabs fields
For i = 0 To intNoXTabs
Set AControl = CreateReportControl(AReport.Name, acTextBox,
acDetail)
With AControl
.Height = 270
.Top = 0
AReport("text" & i).ControlSource =
ARecordset.Fields(i).Name
End With
Next
AReport.Section("detail").Height = 0
AReport.RecordSource = "qryCrossTab"
DoCmd.Close acReport, AReport.Name, acSaveYes
End Function
tab will have heading. So I have the design of the report carried out
programmatically. My code is below to give you an idea iof what I have
done. However, at run time I need to have a field change color depending on
the result of the query.
My question is - Is there any way to, at design time call a function that
will eventually run at run time depending on the result from the query?
Code is
Public Function PrepareAdminReport() As Boolean
Dim ARecordset As DAO.Recordset
Dim AReport As Report
Dim i As Integer
Dim intNoOfCrossTabs As Integer
Dim AControl As Control
Set ARecordset = CurrentDb.OpenRecordset("qryCrossTab")
Set AReport = CreateReport("", "")
intNoOfFields = ARecordset.Fields.count - 1 'No of cross tabs fields
For i = 0 To intNoXTabs
Set AControl = CreateReportControl(AReport.Name, acTextBox,
acDetail)
With AControl
.Height = 270
.Top = 0
AReport("text" & i).ControlSource =
ARecordset.Fields(i).Name
End With
Next
AReport.Section("detail").Height = 0
AReport.RecordSource = "qryCrossTab"
DoCmd.Close acReport, AReport.Name, acSaveYes
End Function