FlexGrid display problem

Could someone please help me??? I am creating a database (access) Visual basic program.  In my code I have the line Set Me.MSFlexGrid1.DataSource = rs, where I try to display data from a recordset into a grid.  I'm using ADO.  I keep getting this error runtime error 91 object variable or with block variable not set.  Is this because I am missing a reference ?  Or that I am trying to use me.SOMETHING, and I need to configure VB to let me do that?
TIA!!!!!
Cheers!
oasisoasisoasisoasisAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

spongieCommented:
Hi Oasis. Did you do this?

Dim rs As new ADODB.Recordset

or

Set rs = new ADODB.Recordset


:)
oasisoasisoasisoasisAuthor Commented:
Private Sub s1_Click()
    Dim datafile As String
    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset
    datafile = App.Path & "\TrackCom Database.mdb"
    ' Create a connection to the database
    Set cn = New ADODB.Connection
    cn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & datafile & ";Persist Security Info=False")
    ' Create a recordset that the MSFlexgrid will use to display records from
    Set rs = New ADODB.Recordset
    With rs
' Attach recordset to connection
        .ActiveConnection = cn
        'Make sure the data will be Updatable
        .CursorLocation = adUseClient
        .CursorType = adOpenStatic
' Open recordset using SQL SELECT statement to select records
        .Open ("SELECT * FROM Hardware")
    End With
   Set MSFlexGrid1.DataSource = rs.DataSource!!!!!!!!DOES NOT LIKE THIS LINE
' Highlight row in MS Hierarchical Flex Grid
   ' Call HighlightCorrectRow


End Sub
oasisoasisoasisoasisAuthor Commented:
I used Set.
Get Blueprints for Increased Customer Retention

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

oasisoasisoasisoasisAuthor Commented:
well i got what i wanted... i made aaa ( a adodc) and it works perfectly fine
With rs
' Attach recordset to connection
        .ActiveConnection = cn
        'Make sure the data will be Updatable
        .CursorLocation = adUseClient
        .CursorType = adOpenStatic
' Open recordset using SQL SELECT statement to select records
        .Open ("SELECT * FROM Hardware WHERE Serial='232'")
       
    End With
    'grid.DataSource = rs
   'Set MSFlexGrid1.DataSource = rs.DataSource
' Highlight row in MS Hierarchical Flex Grid
   ' Call HighlightCorrectRow
Set aaa.Recordset = rs

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
amitverma12679Commented:
Please use MSHFLEXGRID(Hierarchical) rather than MSFLEXGRID
chimistCommented:
u shoud write :
'========================
'Set MSFlexGrid1.DataSource = rs
'=========================
not
'============================
'Set MSFlexGrid1.DataSource = rs.DataSource
'=============================

if it doesn't work, there is another method :
'==================
MSFlexGrid.Cols = Rs.Fields.Count

With RS
do While Not .EOF
MSFlexGrid.AddItem vbtab & .Fields(0) & vbtab & .Fields(1) & vbtab & Fields(2) 'until your last fields....
.movenext
Loop
End With

'In the first u can Define the Widht of Cols and the title of each Cols.
the second method is more better than to set DataSource.
'====================
MYLimCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- PAQ and point No Refund

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

MYLim
EE Cleanup Volunteer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.