Data Grid Problem

06-07-2002, 06:14 AM
Hi there,
I have a data grid and i have a record set. so how can i show entire table structure into the data grid.
the coding is this:

Set cn = New ADODB.Connection
With cn

.Provider = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False"
.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Microsoft Visual Studio\VB98\guage.mdb;Persist Security Info=False"

End With
Dim rsplug As New ADODB.Recordset
rsplug.Open "Select * from plugguage", cn, adOpenDynamic, adLockOptimistic
With rsplug
Do While Not .EOF
Form1.DataGrid1.Columns(0) = rsplug("GoSize").Value
Form1.DataGrid1.Columns(1) = rsplug("MU").Value
Form1.DataGrid1.Columns(2) = rsplug("NoGoSize").Value
Form1.DataGrid1.Columns(3) = rsplug("LocationNo").Value
Form1.DataGrid1.Columns(4) = Format(rsplug("CalibratedDt").Value, "mm/dd/yyyy")
Form1.DataGrid1.Columns(5) = rsplug("ToBeCalibrated").Value
Form1.DataGrid1.Columns(6) = rsplug("Description").Value
Form1.DataGrid1.Columns(7) = rsplug("Qty").Value
End With

at bold part it shows me "run time error "7005"....Row set not available"

please help me.

06-07-2002, 08:16 PM
hi everybody
when i can put ADO directly on form and after assingning the properties i can directly assign the properties of datagrid.
datasource = {adoname}
so that it retrieves the table structure directly and can show the records in table structure.

but if i'm doing by above way....creating recordset. how can i assign this recordset to the datagrid.???

please help me
thanking you

06-07-2002, 09:15 PM
Hi Sachin.

You can assign the recordset to the datagrid.

Dim rs as adodb.recordset
Set rs = new adodb.recordset .......

Set Datagrid.datasource = rs

This will fill the grid will all the data from the rs.
Then, you can hide columns, or change the layout if you want to.

But, each time you reload the datagrid, you will have to reset all of the grid properties.


06-08-2002, 12:41 AM
Hi diver
Actually i did that

set datagrid.datasource = rs

but it is showing me error. It is not recognising the DataSource property.
it shows "member or data function not found"

PLease help me
thank you

06-08-2002, 07:55 AM
Well, make sure you have everything typed in there right.
If your datagrid is named Datagrid1, then use

Set Datagrid1.datasource = rs

If that still does not work, then check and make sure that your recordset (rs) is still around.

If not, then check and see what is the actual OCX you are using... are you using the datagrid, and what version, SP5, etc..

If that still does not work, then post your code up here and then we can fix it.


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum