PDA

Click to See Complete Forum and Search --> : Linking SQL recordset to DataGrid in DAO 3.51


Peterson
Aug 30th, 1999, 09:07 PM
Installed MS VB 6.0 recently and my apps containing DBGrids had the "rug put out from under them." Specifically, DBGrids were disabled when opening projects, only OLEDB Datagrid shows on project Components.

At any rate, I can successfully link a table to a new Datagrid using both DAO 3.51 and OLEDB thru ADODC1. However, in the code below
--------------------------------
Dim history1 As Database
Dim qry As String
Dim Mysnap1 As Recordset
ChDir App.Path
Set history1 = Workspaces(0).OpenDatabase("pedigree.mdb", False, False, ";pwd=genetics;")
qry = "SELECT * FROM Patients Order by [idnumber] ASC"
Set Mysnap1 = history1.OpenRecordset(qry, dbOpenDynaset)
Set Data1.Recordset = Mysnap1

--------------------------------------
I can't replace the command:

Data1.Recordset = Mysnap1

with

ADODC1.Recordset = Mysnap1

any way without getting an error. ADODC1 does have a recordset property, but I can't use it without an error. This prevents me from linking the sorted snapshot with Datagrid through ADODC1.

How can I connect the sorted snapshot (Mysnap1) to a Datagrid with ADODC1?

-LP

Serge
Aug 30th, 1999, 10:37 PM
Recordset is an object, and you have to assign to this object using Set keyword.


Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset

cn.Provider = "Microsoft.Jet.OLEDB.3.51"
cn.Open "D:\Microsoft Visual Studio\VB98\Nwind.mdb", "admin", ""

rs.Open "Select * from customers", cn, adOpenStatic

Set Adodc1.Recordset = rs



Good luck and best regards,

------------------

Serge

Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com