Flexgrid

  • Thread starter Thread starter Mike
  • Start date Start date
Mike,

I think the short answer is no and the long answer is that
if you try the code below:

Option Explicit

Private datPrimaryRS As ADODB.Recordset

Private Sub Form_Load()
Dim sConnect As String
Dim sSQL As String
Dim dfwConn As ADODB.Connection
Dim i As Integer
' set strings
sConnect
= "Provider=Microsoft.Jet.OLEDB.4.0;Password='';User
ID=Admin;Data Source=C:\Program Files\Microsoft Visual
Studio\VB98\Nwind.mdb"
sSQL = "select Address,City,CompanyName,ContactName
from Customers"
' open connection
Set dfwConn = New ADODB.Connection
dfwConn.Open sConnect
' create a recordset using the provided collection
Set datPrimaryRS = New ADODB.Recordset
datPrimaryRS.CursorLocation = adUseClient
datPrimaryRS.Open sSQL, dfwConn, adOpenForwardOnly,
adLockReadOnly

'***********ERROR LINE HERE***********
Set Me.MSHFlexGrid1.DataSource = datPrimaryRS
'*************************************

With MSHFlexGrid1
.Redraw = False
' set grid's column widths
.ColWidth(0) = -1
.ColWidth(1) = -1
.ColWidth(2) = -1
.ColWidth(3) = -1
' set grid's column merging and sorting
For i = 0 To .Cols - 1
.MergeCol(i) = True
Next i
.Sort = flexSortGenericAscending
' set grid's style
.AllowBigSelection = True
.FillStyle = flexFillRepeat
.AllowBigSelection = False
.FillStyle = flexFillSingle
.Redraw = True
End With
End Sub

.... when you try to set the datasource of the FlexiGrid to
the ADODB recordset, you get err.Number = 438; "Object
doesn't support this property or method" even though the
exact same code will work in the VB environment.

I simply don't know the answer. What about others in the
group?

Alastair MacFarlane
 
See Other post.

The only other way to do this would be to create a
property of an OCX that uses your data to populate the
Flexigrid Control and then add this control to the
database.

It is a very round about way of getting the effect you
want.

Alastair MacFarlane
 
Back
Top