Setting MSFlexGrid Datasource property to a Recordset object. 
Author Message
 Setting MSFlexGrid Datasource property to a Recordset object.

Can anybody help me with a problem. I have a form on which grid "grdTable"
(MSFlexGrid). Also I have an ADO connection (cnnRSPL), which is open
succesfully. I need to set a grdTable.Datasource property to a the
rstMainTable Recordset. But at run-time the program shows me en error
"Object variable or With block variable not set" referencing the code line
(Set MyControl.Datasource = rstMainTable).

Please, if you can see an obvious mistake, could you spill the light on it?

****************************************************************************
*

Option Explicit
Private rstMainTable As New ADODB.Recordset
Private rstBigTable As ADODB.Recordset

Private Sub Form_Load()
Dim intCounter As Integer
Dim MyControl As MSFlexGrid

    intCounter = 1

    Set rstMainTable = New ADODB.Recordset

    With rstMainTable.Fields
        .Append "Pos", adInteger
        .Append "Player", adBSTR, 255
        .Append "Total", adInteger
    End With

    rstMainTable.Open
    Set rstBigTable = New ADODB.Recordset

    rstBigTable.Open "tblMainTable", cnnRSPL

    Do While Not rstBigTable.EOF
        rstMainTable.AddNew
        rstMainTable.Fields("Pos").Value = intCounter
        rstMainTable.Fields("Player").Value = rstBigTable("Name").Value
        rstMainTable.Fields("Total").Value = rstBigTable("Total").Value
        rstBigTable.MoveNext
        rstMainTable.Update
        intCounter = intCounter + 1
    Loop

    MsgBox TypeOf grdTable Is MSFlexGrid

    Set MyControl = grdTable
    Set MyControl.Datasource = rstMainTable
End Sub



Sun, 03 Nov 2002 03:00:00 GMT  
 Setting MSFlexGrid Datasource property to a Recordset object.
The MSFlexgrid does not support ADO recordsets. Try using the MSHFlexgrid or
the Datagrid.

--

Andrew Grillage
http://www.concresco.com


Quote:

> Can anybody help me with a problem. I have a form on which grid "grdTable"
> (MSFlexGrid). Also I have an ADO connection (cnnRSPL), which is open
> succesfully. I need to set a grdTable.Datasource property to a the
> rstMainTable Recordset. But at run-time the program shows me en error
> "Object variable or With block variable not set" referencing the code line
> (Set MyControl.Datasource = rstMainTable).

> Please, if you can see an obvious mistake, could you spill the light on
it?

****************************************************************************
Quote:
> *

> Option Explicit
> Private rstMainTable As New ADODB.Recordset
> Private rstBigTable As ADODB.Recordset

> Private Sub Form_Load()
> Dim intCounter As Integer
> Dim MyControl As MSFlexGrid

>     intCounter = 1

>     Set rstMainTable = New ADODB.Recordset

>     With rstMainTable.Fields
>         .Append "Pos", adInteger
>         .Append "Player", adBSTR, 255
>         .Append "Total", adInteger
>     End With

>     rstMainTable.Open
>     Set rstBigTable = New ADODB.Recordset

>     rstBigTable.Open "tblMainTable", cnnRSPL

>     Do While Not rstBigTable.EOF
>         rstMainTable.AddNew
>         rstMainTable.Fields("Pos").Value = intCounter
>         rstMainTable.Fields("Player").Value = rstBigTable("Name").Value
>         rstMainTable.Fields("Total").Value = rstBigTable("Total").Value
>         rstBigTable.MoveNext
>         rstMainTable.Update
>         intCounter = intCounter + 1
>     Loop

>     MsgBox TypeOf grdTable Is MSFlexGrid

>     Set MyControl = grdTable
>     Set MyControl.Datasource = rstMainTable
> End Sub



Sun, 03 Nov 2002 03:00:00 GMT  
 Setting MSFlexGrid Datasource property to a Recordset object.
I am using public recordsets and I open the database with cursor
adUseServer.
I set the datasource of the MSHFlexGrid in a subroutine with the public
recordset.

MS-Access Ok. But with Oracle (and the Oracle ODBC driver) I get error
30023.
I have to use the Oracle ODBC driver because I am using CLOB fields.

Why do I get error 30023 only with Oracle??



Mon, 04 Nov 2002 03:00:00 GMT  
 Setting MSFlexGrid Datasource property to a Recordset object.

Grids are a little fussy about the data they display. They require the
recordset to support bookmarks and sometimes a server side cursor prevents
this. Try using a client side cursor.

--

Andrew Grillage
http://www.concresco.com


Quote:
> I am using public recordsets and I open the database with cursor
> adUseServer.
> I set the datasource of the MSHFlexGrid in a subroutine with the public
> recordset.

> MS-Access Ok. But with Oracle (and the Oracle ODBC driver) I get error
> 30023.
> I have to use the Oracle ODBC driver because I am using CLOB fields.

> Why do I get error 30023 only with Oracle??



Mon, 04 Nov 2002 03:00:00 GMT  
 Setting MSFlexGrid Datasource property to a Recordset object.
ClientSide cursor of Oracle ODBC driver doesn't support CLOB fields
(of course)


Tue, 05 Nov 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. msflexgrid datasource object variable not set error

2. MSFlexgrid.datasource = recordset - Error - Please help.

3. MSFlexgrid datasource property

4. MSFlexGrid - setting datasource in code, problem.

5. MSFlexGrid - Problem setting datasource

6. MSFlexGrid - setting datasource in code, problem.

7. Setting a recordset object to a data control's recordsource property

8. ! Datasource property not set

9. set DataSource and DataField properties

10. How to set datasource with empty recordset

11. How to set DbGrid datasource to a recordset created w/ADODB.Command

12. COM object recordset as datasource.

 

 
Powered by phpBB® Forum Software