Link to home
Start Free TrialLog in
Avatar of laurent_diep
laurent_diepFlag for France

asked on

I cannot set MSFlexGrid datasource by code.

Hi everyone,

I try to simply set the MSFlexGrid datasource property and I get a 91 error : Object variable not defined.

I know that this question has been already asked (I made the search in EE but it is impossible for me to access the answer since I did not subscribe).

I made the search on google : but impossible to find the question I have seen in EE. (could you explain that to me).

Here is my code :

'**************************************************

    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset

    Set cn = New ADODB.Connection

    cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Program Files\FarPointSpread\Samples\ActiveX\VB6\Demo Overview\common\Nwind.mdb;Persist Security Info=False"

    cn.Open

    Set rs = New ADODB.Recordset

    rs.Source = "SELECT Customers.CompanyName, Orders.OrderID, Orders.OrderDate, Products.ProductName " & _
            "FROM ((Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID) " & _
            "INNER JOIN [Order Details] ON Orders.OrderID = [Order Details].OrderID) INNER JOIN Products ON [Order Details].ProductID = Products.ProductID;"

    Set rs.ActiveConnection = cn

    rs.Open
   
   Set flex.DataSource = rs       <-----------------  Error 91

'***********************************************************

Thanks for your help.

laurent_diep.
ASKER CERTIFIED SOLUTION
Avatar of Preece
Preece
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of laurent_diep

ASKER

Preece :

Thank you very much for your links.

I will do what they say : use MSHFlexGrid (Microsoft Hierarchical Flex Grid).

By the way don't you know why I don't get the same search results with EE and Google ?

laurent_diep.
They probably want you to sign up as a member to have access to everything...

Check the faqs and such...

Preece
Yeah, I think so.

Thank again.

laurent_diep.