setting the datasource for datagrid

hi i would like to appreciate if someone could help me out with my problem with datagrid control in populating it.

here is my code.

Private Sub cmdSearch_Click()

ConnectToDatabase

Dim rsTemp As ADODB.Recordset
Dim strSearchBy As Long

Set rsTemp = New ADODB.Recordset
rsTemp.Open "SELECT * FROM subdetails WHERE UserID = '" & txtSearchFor.Text & "'", conn, adOpenDynamic, adLockOptimistic
MsgBox rsTemp.RecordCount
'rsTemp.Open "Select * from subdetails", conn, adOpenDynamic, adLockOptimistic

Set dtgDetails.DataSource = rsTemp
'Set mflexDetails.DataSource = rsTemp
'mflexDetails.Refresh
dtgDetails.Refresh
End Sub

Public Sub ConnectToDatabase()
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "database.mdb"
conn.Open
End Sub

ERROR MESSAGE:

run time error 7004
" the rowset is not bookmarkable ! "
mflexDetails.Refresh

Please try to help me out on this one... thanks

mhyke
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories