MSHFlexGrid with DataSource Problem
I have a problem with my MSHFlexGrid when reading really long string from memo field. It seems that recordset will not set and I got the error of:
Run-time error2147417848 (80010108)
Automation Error
or Method 'DataSource' of object 'IMSHFlexGrid' failed.
my code for reading database is:
below is in frmMain
--------------------------------------------------------------
opendb etc..
sqlstr = "Select f1, f2, f3, memo from myTable where id=1"
setResult_Ado1 sqlstr
If (rsRecordset.RecordCount > 0) Then
Set Adodc2.Recordset = rsRecordset
Adodc2.Refresh
Set MSHFlexGrid2.DataSource = Adodc2
set_Flex2 Me
Else
MSHFlexGrid2.Clear
MSHFlexGrid2.Rows = 2
End If
closedb etc..
--------------------------------------------------------------
Sub setResult_Ado1 sqlstr is called from module which as below
--------------------------------------------------------------
public sub opendb
...
end sub
public sub closedb
...
end sub
Public Sub setResult_Ado1(sql As String)
Set rsRecordset = New ADODB.Recordset
rsRecordset.ActiveConnection = cnConnection
rsRecordset.Source = sql
rsRecordset.CursorLocation = adUseClient
rsRecordset.Open , , adOpenKeyset, adLockReadOnly
End Sub
--------------------------------------------------------------
I got Set MSHFlexGrid2.DataSource = Adodc2 as nothing therefore nothing.
any help?
thanks
|