![]() |
Load Records From ADO Recordset |
Post Reply ![]() |
Author | |
DueSoft ![]() Newbie ![]() ![]() Joined: 08 July 2006 Location: Indonesia Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() Posted: 08 July 2006 at 12:50am |
Hi...
Please help me... How to adding records item from ado recordset? Thank's B4. |
|
![]() |
|
sserge ![]() Moderator Group ![]() Joined: 01 December 2004 Status: Offline Points: 1297 |
![]() ![]() ![]() ![]() ![]() |
Hi,
This should be done via your code: -- open a recordset; -- iterate all records; -- for every of them, create a corresponding ReportRecord object; -- for every field of the record, add a corresponding ReportRecordItem object to the ReportRecord (for corresponding columns). -- call ReportControl.Populate -- WBR, Serge |
|
![]() |
|
DueSoft ![]() Newbie ![]() ![]() Joined: 08 July 2006 Location: Indonesia Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() |
Thank's B4,
I'm is new use this control, can you help me. please tell me way to write it's code? Thank's |
|
![]() |
|
OscarM ![]() Groupie ![]() Joined: 07 November 2005 Status: Offline Points: 72 |
![]() ![]() ![]() ![]() ![]() |
Dim pCol As ReportColumn
Dim pRecord As ReportRecord, pItem As ReportRecordItem Dim pField As ADODB.Field Dim i As Long For Each pField In Rs.Fields With Rp1 Set pCol = .Columns.Add(i, pField.Name, 100, True) Select Case pField.Type Case adBigInt, adDecimal, adDouble, adInteger, adNumeric, adSingle, adSmallInt, adTinyInt 'todo Case adBoolean 'todo Case adDate, adDBDate, adDBTime, adDBTimeStamp 'todo End Select End With Next Do Until Rs.EOF Set pRecord = Rp1.Records.Add For Each pField In Rs.Fields If pField.Type = adBoolean Then Set pItem = pRecord.AddItem("") pItem.HasCheckbox = True pItem.Checked = pField.Value = True Else Set pItem = pRecord.AddItem(pField.Value) End If Next Rs.MoveNext Loop Rp1.Populate Set pCol = Nothing Set pField = Nothing Set pRecord = Nothing Set pItem = Nothing |
|
![]() |
|
DueSoft ![]() Newbie ![]() ![]() Joined: 08 July 2006 Location: Indonesia Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() |
It's Great! But sorry, i'm done understand about this code, '------------------------------------------- Select Case pField.Type Case adBigInt, adDecimal, adDouble, adInteger, adNumeric, adSingle, adSmallInt, adTinyInt 'todo Case adBoolean 'todo Case adDate, adDBDate, adDBTime, adDBTimeStamp 'todo End Select '------------------------------------------------------ When i try this code, i have a problem, For example : I have data like this : ---------------------------------- |No |Name |Phone | ---------------------------------- |1 |Boy |123456 | |2 |David |25633 | ---------------------------------- when i try, the result is like this : ---------------------------------- |No |Name |Phone | ---------------------------------- |1 |1 |1 | |1 |1 |1 | ---------------------------------- Why???? and what i do in code 'todo', please help me.... Can you send me fully code or VB Project for this code? Thank's Best Regards. |
|
![]() |
|
Timothy5 ![]() Newbie ![]() Joined: 03 March 2007 Status: Offline Points: 2 |
![]() ![]() ![]() ![]() ![]() |
I have a similar issue when I use columns that meet the Case conditions. What is the solution?
|
|
![]() |
|
Timothy5 ![]() Newbie ![]() Joined: 03 March 2007 Status: Offline Points: 2 |
![]() ![]() ![]() ![]() ![]() |
Added i = i + 1 just after the case statement to correct the issue. |
|
![]() |
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 |