laurent_diep
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.OL EDB.4.0;Da ta Source=D:\Program Files\FarPointSpread\Sampl es\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.
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.OL
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
They probably want you to sign up as a member to have access to everything...
Check the faqs and such...
Preece
Check the faqs and such...
Preece
ASKER
Yeah, I think so.
Thank again.
laurent_diep.
Thank again.
laurent_diep.
ASKER
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.