This is my first time using the report control, and I am having some trouble displaying records. I have viewed the samples, and get close to it working right, but not quite.
I am using the control to display results from a database when multiple records are retrieved. I can get the control to appear that it has two rows, as it should, but the text won't show up. I am sure I am missing something simple, but I can't seem to find what it is.
Here is my code.
This is in the form load sub
Private Sub Form_Load() On Error GoTo ErrorHandler
Dim PSColumn As ReportColumn
Set PSColumn = PSReportControl.Columns.Add(ID_SELECT_FIRSTNAME, "First Name", 10, True) PSColumn.AllowDrag = False PSColumn.AllowRemove = False PSColumn.Editable = False PSColumn.AutoSize = True PSColumn.Visible = True Set PSColumn = PSReportControl.Columns.Add(ID_SELECT_LASTNAME, "Last Name", 10, True) PSColumn.AllowDrag = False PSColumn.AllowRemove = False PSColumn.Editable = False PSColumn.AutoSize = True PSColumn.Visible = True Set PSColumn = PSReportControl.Columns.Add(ID_SELECT_ID, "ID", 4, True) PSColumn.AllowDrag = False PSColumn.AllowRemove = False PSColumn.Editable = False PSColumn.AutoSize = True PSColumn.Visible = False
Exit Sub ErrorHandler: ErrorAlert.ErrorAlert Err.Number, Err.Description, "frmPersonnelSelection.Form_Load" End Sub
this is is the sub that recieves the data from the database.
ElseIf .RESULT_COUNT > 1 Then Dim I As Integer For I = 1 To .RESULT_COUNT AddPSRecord .FIRST_NAME, .LAST_NAME, .ID Next I frmPersonnelSelection.PSReportControl.Populate frmPersonnelSelection.Show (1) End If
and this is the code that is in the AddPSRecord sub
Public Sub AddPSRecord(ByVal FirstName As String, ByVal LastName As String, ByVal RecordID As Long) On Error GoTo ErrorHandler
Dim PersonnelRecord As ReportRecord Dim PersonnelItem As ReportRecordItem
Set PersonnelRecord = frmPersonnelSelection.PSReportControl.Records.Add
Set PersonnelItem = PersonnelRecord.AddItem(FirstName) Set PersonnelItem = PersonnelRecord.AddItem(LastName) Set PersonnelItem = PersonnelRecord.AddItem(RecordID)
Exit Sub ErrorHandler: ErrorAlert.ErrorAlert Err.Number, Err.Description, "ResourceMOD.AddRecord" End Sub
As I said, it appears to add the rows, but not the text. I did step thru the code and the variables are holding a proper value.
Thank you for your help.
Ben
|