|  | 
| Trouble adding records | 
| Post Reply   | 
| Author | |
| Krenshau   Groupie     Joined: 15 October 2005 Location: United States Status: Offline Points: 49 |  Post Options  Thanks(0)  Quote  Reply  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 | |
|  | |
| moe188   Senior Member   Joined: 27 March 2006 Status: Offline Points: 225 |  Post Options  Thanks(0)  Quote  Reply  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 | |
|  | |
| sserge   Moderator Group   Joined: 01 December 2004 Status: Offline Points: 1297 |  Post Options  Thanks(0)  Quote  Reply  Posted: 26 June 2006 at 5:16am | 
| 
   Try adding some text for test, like: 
 Check whether it is displayed properly. -- WBR, Serge | |
|  | |
| Krenshau   Groupie     Joined: 15 October 2005 Location: United States Status: Offline Points: 49 |  Post Options  Thanks(0)  Quote  Reply  Posted: 26 June 2006 at 5:28pm | 
| 
   I tried the 
 
 and it put more rows on the control, but still no text. Thank you for helping me. | |
|  | |
| sserge   Moderator Group   Joined: 01 December 2004 Status: Offline Points: 1297 |  Post Options  Thanks(0)  Quote  Reply  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 | |
|  | |
| Post Reply   | |
| Tweet | 
| Forum Jump | Forum Permissions  You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |