Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Trouble adding records
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Trouble adding records

 Post Reply Post Reply
Author
Message
Krenshau View Drop Down
Groupie
Groupie
Avatar

Joined: 15 October 2005
Location: United States
Status: Offline
Points: 49
Post Options Post Options   Thanks (0) Thanks(0)   Quote Krenshau Quote  Post ReplyReply Direct Link To This Post Topic: Trouble adding records
    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
Back to Top
moe188 View Drop Down
Senior Member
Senior Member


Joined: 27 March 2006
Status: Offline
Points: 220
Post Options Post Options   Thanks (0) Thanks(0)   Quote moe188 Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Krenshau View Drop Down
Groupie
Groupie
Avatar

Joined: 15 October 2005
Location: United States
Status: Offline
Points: 49
Post Options Post Options   Thanks (0) Thanks(0)   Quote Krenshau Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.