
Command object, DataSource property - strange behaviour
Hi!
I use MS-Access 2000 database through ADO (provider is Jet 4.0 OLEDB
Provider). In my application I ask a query from that database using
Command object (it's a parameter query). When I execute the Command, I
get recordset. Now I want to assign this recordset to MSHFlexGrid's
DataSource property. No errors, but only one record appears in grid.
All my stuff started to work normally when I used the following (short)
code fragment:
' Execute the command
Set Rs = Cmd.Execute()
' Close recordset, assign properties
' and open it again
Rs.Close
Rs.CursorLocation = adUseClient
Rs.CursorType = adOpenDynamic
Rs.Open
'Assign recordset to MSHFlexGrid
Set Me.dbgCustom.DataSource = Rs
If I don't close the recordset, don't assign it's cursor properties,
there's only one record in a grid again. Why?
With best regards,
Gunnar Peipman