将variables设置为DAO.Recordset中的字段引用

我有以下代码;

Dim tbloutput As DAO.Recordset Dim i As Integer Dim v As String Set tbloutput = dbLocal.OpenRecordset("tbl_temp_forecast") For i = 38 To 52 v = CStr(i) .Cells(Rowindex, Columnindex).Value = tbloutput![v] Columnindex = Columnindex + 1 v = "" Next 

我遇到的问题是当我尝试引用tbloutput![列名]我想使用v或我的价值,但一个简单的tbloutput![我]或tbloutput![v]不起作用。

你能提供这个build议吗?

谢谢

你的代码有一个小的改正。

Dim tbloutput As DAO.Recordset Dim i As Integer Dim v As String Set tbloutput = dbLocal.OpenRecordset(“tbl_temp_forecast”)

 For i = 38 To 52 v = CStr(i) .Cells(Rowindex, Columnindex).Value = "tbloutput![" & v & "]" Columnindex = Columnindex + 1 v = "" Next 

让我知道这个是否奏效…