我从 recordset.Fields(0) 得到什么?

What do I get from recordset.Fields(0)?

我是 VBA 的新手,我必须理解别人写的代码。这是她为变量设置的内容:

Sub LTMovementSum1(y As Long, strStoreArea As String)
    Dim recTmp As DAO.Recordset
    Dim lngTotalLTagg As Long
    lngTotalLTagg = 0

If Control.intLBoSNR = 1 Then
        strQuery = "SELECT count(TIS_LAGERSPIEGEL.LT) FROM TIS_AGG_SNR " & _
                    "LEFT JOIN TIS_LAGERSPIEGEL ON TIS_AGG_SNR.SNR_KARTE=TIS_LAGERSPIEGEL.SNR_KARTE " & _
                    "WHERE TIS_AGG_SNR.LB= """ & strStoreArea & """;"
        Set recTmp = db.OpenRecordset(strQuery)

        If Not IsNull(recTmp.Fields(0)) Then lngTotalLTagg = recTmp.Fields(0)
    ElseIf Control.intLBoSNR = 2 Then
        strQuery = "SELECT count(TIS_LAGERSPIEGEL.LT) FROM SELECTED_SNR " & _
                   "LEFT JOIN TIS_LAGERSPIEGEL ON SELECTED_SNR.SNR_SPEICHER = TIS_LAGERSPIEGEL.SNR_SPEICHER;"
        Set recTmp = db.OpenRecordset(strQuery)

        If Not IsNull(recTmp.Fields(0)) Then lngTotalLTagg = recTmp.Fields(0)
    End If

我不太明白我从recTmp = db.OpenRecordset(strQuery)中得到了什么 以及来自 recTmp.Fields(0)

的内容

我真的希望有人能帮助我,谢谢!

PS.: db 是我来自 Access

的数据库

想象力和幻想太少,你会遇到很多坎坷。

但是,此 打开 (a) 记录集 基于查询:

Set recTmp = db.OpenRecordset(strQuery)

这会读取当前行第一个字段的值:

lngTotalLTagg = recTmp.Fields(0)