Print Page | Close Window

Trouble adding records

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=4470
Printed Date: 01 April 2025 at 12:43am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Trouble adding records
Posted By: Krenshau
Subject: Trouble adding records
Date Posted: 22 June 2006 at 4:54pm
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



Replies:
Posted By: moe188
Date Posted: 24 June 2006 at 6:32pm
Hi,
I had the same problem before, and I am using almost the same code, but from your code, the AddPSRecord will only let you show the data that you request (FirstName, LastName and RecordID)
I think you need to add a Text to AddPSRecord, then use .PreviewText
good luck


Posted By: sserge
Date Posted: 26 June 2006 at 5:16am
Try adding some text for test, like:

Set PersonnelItem = PersonnelRecord.AddItem("FirstName")

Check whether it is displayed properly.

--
WBR,
Serge


Posted By: Krenshau
Date Posted: 26 June 2006 at 5:28pm
I tried the

Set PersonnelItem = PersonnelRecord.addItem("FirstName")
and it put more rows on the control, but still no text.
 
Thank you for helping me.


Posted By: sserge
Date Posted: 27 June 2006 at 5:08pm
So far, as it has been clarified: soluition is to set ID_SELECT_* const values to consequent integers starting from 0.

--
WBR,
Serge



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net