开发者

Get Query Results in a String

If I run a query to select three seperate fields from each record. Is it possible to get the results for each returned in three separate strings (one for each field) so开发者_开发问答 that I can cycle through them in vba code?


Yes, you can try opening a Recordset and accessing the field values like a collection.

Dim d As DAO.Database
Dim r As DAO.Recordset
Set d = CurrentDb()
Set r = d.OpenRecordset("SQL or TableName")
While Not r.EOF
    Debug.Print r!Field1, r!Field2, r!Field3
    r.MoveNext
Wend
r.Close
Set r = Nothing
Set d = Nothing
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜