|
|
|||
Home Products Downloads Registered users Support Prices Order Primary Subscription |
|
||
XLReport EventsAfterMasterMoveNextOccurs in multiple-sheet reporting when the master dataset is positioned to the current record (including the first record).
Event AfterMasterMoveNext(MasterSource As XLRDatasource, _
DetailSource As XLRDatasource, Params)
In case of master-detail report as well as multiple-sheet report, you must supply the XLReport with a correct detail dataset for every record of a master dataset. Note that in case of multiple-sheet report, this event is triggered for every top-level Range-datasource on a worksheet. When Active XL Report moves to the next record of the master datasource (including the first record), it triggers this event. You have to recognize the record from the MasterSource and supply the DetailSource with an appropriate dataset. The Params contains the record number of the MasterSource if the DatasetType is xlrUnboundDatset and the Empty value in all other cases. The following example uses ADO and the Recordset.Filter property:
Private Sub ocxXLReport_AfterMasterMoveNext(ByVal MasterSource As axlr.XLRDatasource, _
ByVal DetailSource As axlr.XLRDatasource, Params As Variant)
End Sub
Select Case MasterSource.Name
Case "Customers"
End Select
DetailSource.Dataset.Filter = "CustNo=" & MasterSource.Dataset.Fields("CustNo")
Case "Orders"
DetailSource.Dataset.Filter = "OrderNo=" & MasterSource.Dataset.Fields("OrderNo")
Microsoft recommends recreating a recordset instead of using the Filter property in DAO, so:
... Select Case MasterSource.Name
Case "Customers"
...
Set DetailSource.Dataset = CurrentDb.OpenRecordset( _
"Select * from orders Where CustNo=" & dsrMasterSource.Dataset("CustNo"))
To Microsoft Access users. Because of differences in event handling, the MasterSource and DetailSource parameters are declared as Object (and not axlr.Datasource) in the AfterMasterMoveNext event handler. We recommend using type casting for convenience, for example:
Private Sub ocxXLReport_AfterMasterMoveNext(ByVal MasterSource As Object, _
ByVal DetailSource As Object, Params As Variant)
Dim dsrMasterSource As axlr.XLRDatasourceDim dsrDetailSource As axlr.XLRDatasource Set dsrMasterSource = MasterSource Set dsrDetailSource = DetailSource ... See also: XLRDatasource class, XLRDatasource.Dataset property, XLRDatasource.MasterSourceName property, XLReport.MultisheetSourceName property, XLReport.MultisheetFieldName property. GetDatasetInfoOccurs when Datasource.DatasetType is xlrUnboundDataset and you don't supply the datasource with dataset both through the Datasorce.Dataset property and Datasets parameter of the Report, ReportTo, and Report2 methods.
Event GetDatasetInfo(Datasource As XLRDatasource, Params)
The Datasource input parameter contains the datasource triggering this event. You must return 2D-array describing the datasource ("field" names and types) in the Params output parameter. The array must contain N columns ("fields") in two rows: the first row contains the "field" names; the second row contains the "field" types. Available field types are listed below:
Enum DataTypes
xlrNotSupported = 0
End Enum
xlrInteger = 1 xlrBoolean = 2 xlrFloat = 3 xlrDateTime = 4 xlrString = 5 "Fields" described as xlrNotSupported are not transferred into a report. Example:
Private Sub ocxXLReport_GetDatasetInfo(ByVal Datasource As axlr.XLRDatasource, _
Params As Variant)
End Sub
Params = Array(Array("Name1", "Name2", "Name3"), _
Array(xlrInteger, xlrFloat, xlrString ))
To Microsoft Access users. Because of differences in event handling, the Datasource parameter is declared as Object (and not axlr.Datasource) in the GetDatasetInfo event handler. We recommend using type casting for convenience, for example:
Private Sub ocxXLReport_GetDatasetInfo(ByVal Datasource As Object, Params As Variant) Dim dsr As axlr.XLRDatasource Set dsr = Datasource ... See also: XLReport.GetRecord event, XLRDatasource class, XLRDatasource.Dataset property. GetRecordOccurs when Datasource.DatasetType is xlrUnboundDataset and you don't supply the datasource with dataset both through the Datasorce.Dataset property and Datasets parameter of the Report, ReportTo, and Report2 methods.
Event GetRecord(Datasource As XLRDatasource, RecNo As Long, Values, Eof As Boolean)
The Datasource input parameter contains the datasource triggering this event. The RecNo input parameter contains the record number (starting from 1) you are queried of. You must return 1D-array containing the record in Values parameter. In order to indicate the EOF flag, return True (-1) in the Eof parameter. Example:
Private Sub ocxXLReport_GetRecord(ByVal Datasource As axlr.XLRDatasource, _
ByVal RecNo As Long, Values As Variant, Eof As Boolean)
End Sub
Eof = False Select RecNo
Case 1
End Select
Values = Array(123, 5.5, "Hello 1")
Case 2
Values = Array(321, 3.3, "Hello 2")
Case 3
Eof = True
This event follows the GetDatasourceInfo event. To Microsoft Access users. Because of differences in event handling, the Datasource parameter is declared as Object (and not axlr.Datasource) in the GetRecord event handler. We recommend using type casting for convenience, for example:
Private Sub ocxXLReport_GetRecord(ByVal Datasource As Object, ByVal RecNo As Long, _
Values As Variant, Eof As Boolean)
Dim dsr As axlr.XLRDatasourceSet dsr = Datasource ... See also: XLRDatasource.GetDatasetInfo event, XLRDatasource class, XLRDatasource.Dataset property. |
Components
Data Access methods
Excel version supportedMS Excel 97 (SR2)
[ Download it ] |