Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

adapt datagrid

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • adapt datagrid

    Hi everyone this is what i have strQuery = "SELECT Last(tblGegevens.ID) AS LastOfID, tblGegevens.Pc AS PCname, Last(tblGegevens.ChangeDate) AS LastOfChangeDate, Last(tblGegevens.ChangeTime) AS LastOfChangeTime From tblGegevens GROUP BY tblGegevens.Pc HAVING ((tblGegevens.Pc) Like '" & mstrComputername & "');" rs.Open strQuery, conn, adOpenStatic, adLockOptimistic 'puts info in textboxes If Not rs.EOF Then txtPc.Text = rs.Fields("PCname").Value & "" txtDate.Text = rs.Fields("LastOfChangeDate").Value & "" txtTijd.Text = rs.Fields("LastOfChangeTime").Value & "" End If Sluiten as you can see i have a query (for which i know gives 1 result back) let this see in textboxes but i also want it to see in the datagrid herefor i have to chance the datagrid open the datagrid in the form_load where i also do this Set conn = New ADODB.Connection Set rs = New ADODB.Recordset conn.ConnectionString = mstrConnection conn.Open then sluiten is a sub procedure and this is what it holds Private Sub Sluiten() rs.Close Set rs = Nothing conn.Close Set conn = Nothing End Sub People told me not to close rs when i am changing the datagrid so this is why i made this extra sub But what i also do the datagrid stays empty Can anyone help me how to chance the info in the datagrid for example when i click on a button? Thanks in advance

  • #2
    adapt datagrid

    Do that first and make sure that the Recordset actually has data at the time the Grid is being loaded. The other thing that I'd do is to make sure you're object variables are scoped correctly. I normally use un-bound grids but check you're data grid to see if there is a Refresh Method or somthing similar. You may need to do that after Opening the Recordset. And sorry for stating the obvious, but check to make sure the grid's Record Source ( or Data Source ) property is really what you think it should be.

    Comment

    Working...
    X