2016-12-14 11 views

答えて

3

これは整数を返すクエリで私のために働い:

Public Sub runQuery(ByVal query As String) 

    Dim DB As DAO.Database: Set DB = CurrentDb() 
    Dim rst As DAO.Recordset: Set rst = DB.OpenRecordset(query) 

    Do While Not rst.EOF 
     Dim rowStr As String: rowStr = "" 
     Dim fld As Field 
     For Each fld In rst.Fields 
      rowStr = rowStr & fld & " " 
     Next fld 

     Debug.Print (rowStr) 

     rst.MoveNext 

    Loop 

End Sub 

イミディエイトウィンドウからそれを呼び出す:

runQuery "SELECT Foo, Bar FROM MyTable WHERE Foo < 42" 
関連する問題