none
VBA-ADODB..DataGrid is not displaying any data RRS feed

  • Question

  • I  am using below code but it doesnot display any data, Please let me know what I am doing wrong

                    Dim PLT As New ADODB.Connection
                   
    Dim MyRecSet As New ADODB.Recordset

                   
    Set PLT = New ADODB.Connection
                    PLT
    .ConnectionString = "xyz"
                    PLT
    .Open
                   
    Set MyRecSet = New ADODB.Recordset
                   
    Set MyRecSet = PLT.Execute("SELECT * FROM Action_item")
                   
    If Not MyRecSet Is Nothing Then
                   
    If MyRecSet.State Then
                    MyRecSet
    .Close
                   
    End If
                   
    End If
                 MyRecSet
    .CursorLocation = adUseClient
                
    Set DataGrid1.DataSource = MyRecSet
                 DataGrid1
    .Refresh

    Wednesday, May 14, 2014 7:14 AM

All replies

  • You cant use Datagrid in VBA. This is a VB6 control.

    Use ListView or Listbox to import datas.


    Oskar Shon, Office System MVP - www.VBATools.pl
    if Helpful; Answer when a problem solved

    Thursday, June 5, 2014 8:52 PM
    Answerer