Here's the code used to save/load the report settings (note that the code verify's whether a file has already been created to save the settings for the particular report):
Private Sub SaveReportSettings(sType As String)
Dim FreeF As Integer, sFile As String, sLayout As String sFile = App.Path & "\" & sType & ".000" FreeF = FreeFile If VerifyFile(sFile) Then Kill sFile End If Open sFile For Binary As #FreeF Put #FreeF, , frmMain.wndReportControl.SaveSettings Close #FreeF
End Sub Private Function LoadReportSettings(sType As String) As Boolean Dim FreeF As Integer, sFile As String, sLayout As String
If VerifyFile(App.Path & "\" & sType & ".000") Then On Error GoTo LoadReportSettings_Error sFile = App.Path & "\" & sType & ".000" FreeF = FreeFile sLayout = Space(FileLen(sFile)) Open sFile For Binary As #FreeF Get #FreeF, , sLayout Close #FreeF frmMain.wndReportControl.LoadSettings sLayout Else Exit Function End If LoadReportSettings = True Exit Function LoadReportSettings_Error: Err.Clear Exit Function End Function
Here's the code setting up the report:
Private Sub CreateItemReport(sFilter As String) Dim Column As ReportColumn Dim lIndex As Long With frmMain.wndReportControl.Columns Set Column = .Add(lIndex, "Item ID", 4, True) lIndex = lIndex + 1 Column.Visible = False Set Column = .Add(lIndex, "Subject", 60, True) lIndex = lIndex + 1 Set Column = .Add(lIndex, "Description", 100, True) lIndex = lIndex + 1 Column.Visible = False Set Column = .Add(lIndex, "Type", 6, True) lIndex = lIndex + 1 Column.Visible = False Set Column = .Add(lIndex, "Start Time", 20, True) lIndex = lIndex + 1 Column.Alignment = xtpAlignmentRight Set Column = .Add(lIndex, "End Time", 20, True) lIndex = lIndex + 1 Column.Visible = False Column.Alignment = xtpAlignmentRight End With
'Add Records to the ReportControl ProcessItemRS sFilter, g_sItem
End Sub
Here's the code writing the data to the report:
Private Sub AddItemRecord(objItem As Object, lItemID As Long, sID As String, _ lItemID As Long) Dim Record As ReportRecord Dim Item &n bsp; As ReportRecordItem Set Record = frmMain.wndReportControl.Records.Add() With Record .Tag = sID .AddItem lItemID .AddItem objItem.Subject .AddItem objItem.Description .AddItem objItem.Type .AddItem objItem.StartTime .AddItem objItem.EndTime End With End Sub
Hopefully, this helps. Let me know if you need any add'l info.
Thanks!
|