Click here to Skip to main content
12,250,546 members (48,710 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB Access
I want to populate datagrid use a SQL Query. I don't want to use ADODC kind of control.

Please suggest.
I wrote the coding but it's not working.

Dim db As ADODB.Connection
Dim rs As ADODB.Recordset
Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
Dim str As String
str = "Select * from table1"
db.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\db1.mdb"
Set rs = db.Execute(str)
Set DataGrid1.DataSource = rs
Error is saying RowSet is not bookmarkable

Any other code segment will also helpful for me.

I just want to populate the datagrid using a SQL Query.

Please Help
Posted 8-Jun-11 10:11am
Edited 8-Jun-11 10:14am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can solve it by adding CursorLocation = adUseClient

Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
Sourav972 9-Jun-11 0:48am
can you tell me, what the above line will do?
Amit Kumar Tiwari 9-Jun-11 4:26am
Read the article for detail @
Sourav972 9-Jun-11 12:07pm
Thank you so much

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 8 Jun 2011
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100