Function execsql(ByVal strsql As String) As ADODB.Recordset
    Dim rstaccess As ADODB.Recordset
    Set cnn = New ADODB.Connection
    conn.Open (conndb) --conndb为连接数据库的connectionstring
    conn.Execute strsql
    Set rstaccess = New ADODB.Recordset
    Set execsql = rstaccess
End Function

解决方案 »

  1.   

    Function execsql(ByVal strsql As String) As ADODB.Recordset
        Dim rstaccess As ADODB.Recordset
        Set cnn = New ADODB.Connection
        conn.Open (conndb) --conndb为连接数据库的connectionstring
        Set execsql = conn.Execute strsql
    End Function
      

  2.   

    Function execsql(ByVal strsql As String) As ADODB.Recordset
        Dim rstaccess As ADODB.Recordset
        Set cnn = New ADODB.Connection
        conn.Open (conndb) --conndb为连接数据库的connectionstring
        Set execsql = conn.Execute (strsql)     
    End Function