Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with this part of source...

Status
Not open for further replies.

flac0

Programmer
Oct 31, 2001
22
UY
hi people!
i'm using ado datacontrol with a bound datagrid, and at runtime i set de cols of the grid with the cols of my recordset... it does well, but when doesn't show the data in rows...the grid is empty...

I set de grid datasource with the datacontrol in datagrid properties and rebind and refresh but without lucky...

the idea of this source it's show in a datagrid the data of the recordset,setting some cols...

here goes the problematic source...thank's



Public Function Show() As Boolean

Dim Sql As String
Dim dcField As ADODB.Field
Dim Rst As ADODB.Recordset
Dim Cont As Integer
Dim X As Integer
Dim grdCol As DataGrid
Dim colNew

On Error GoTo ErrHandler

Sql = " SELECT * "
Sql = Sql & " FROM TmpScotHsExtras "
Sql = Sql & " ORDER BY NROREGISTRO"

Set Rst = New ADODB.Recordset
Rst.ActiveConnection= "Provider=Microsoft.Jet.OLEDB.4.0;DataSource=" & dbtools.DatabaseName & ";"
Rst.CursorType = adOpenKeyset
Rst.LockType = adLockOptimistic
Rst.Open Sql

grdErrores1.EditActive = True
Set dcErrores.Recordset = Rst

For Each dcField In Rst.Fields
If Len(Trim(dcField.Name)) > 0 And Left(Trim(dcField.Name), 1) <> &quot;X&quot; Then
Set colNew = grdErrores1.Columns.Add(grdErrores1.Columns.Count)
With colNew
.Visible = True
.Caption = dcField.Name
.DataField = dcErrores.Recordset.Fields(dcField.Name).Name
.Alignment = dbgRight
End With
End If
Next

Call grdErrores1.ReBind
Call grdErrores1.Refresh

Me.Show vbModal, MainForm
Show = frmScotHsExtras.Continuar
GoTo CleanExit

ErrHandler:
Unload Me
show = False
CleanExit:
Set Rst = Nothing
' Set dcErrores = Nothing
' Set dcField = Nothing

End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top