PDA

Click to See Complete Forum and Search --> : DataGrid Question


Dillinger4
Oct 1st, 2000, 02:39 PM
Im having an extremely hard time with this dang
DataGrid!!! {{{Laughing}}} Im not to sure of what
im doing wrong.

With DataGrid1
.Columns.Add(0).Caption = "Account Name"
.Columns.Add(1).Caption = "Driver ID"
.Columns.Add(2).Caption = "# of Tickets"
.Col = 0
.Row = 0
.Text = "Shaka Zulu"
End With

The column headers come out good but if i try
just to print a string in a column i get a run time
error "7005 Row Set not Available" As for now im just trying to get something in my DataGrid. Anything !!!
What i am ultimately trying to do is open a recordset
with an SQL statement and fill in the first column
with the results of the SQL string.

Set db = OpenDatabase("C:\Database.mdb")
strSQL = "SELECT * From [Account Information]"
Set rs = db.OpenRecordset(strSQL)

With DataGrid1
.DataSource = rs
.Columns.Add(0).Caption = "Account Name"
.Columns.Add(1).Caption = "Driver ID"
.Columns.Add(2).Caption = "# of Tickets"
End With

Do Until rs.EOF
DataGrid1.Text = rs![Account Name]
rs.MoveNext
DataGrid1.Row = DataGrid1.Row + 1
Loop
Thanks All............

RAMOSF
Oct 1st, 2000, 09:28 PM
???
you want the Datagrid to show your query results?!?!?!


Set Datagrid.Datasource = Recordset


thatīs all.... you need