Sub Refreshjl()
    connfile
    strsql = "SELECT 本厂编号 FROM 记录卡  where format(检定日期,'yyyy-m')='" & Form12.Combo2.Text & "-" & Form12.Combo1.Text & "'"
    If rsTemp.State = adStateOpen Then rsTemp.Close
    rsTemp.CursorLocation = adUseClient
    rsTemp.Open strsql, cnnfile, adOpenKeyset, adLockOptimistic
    With rsTemp
        If rsTemp.RecordCount > 0 Then
            With jianding
                .Rows = IIf(rsTemp.RecordCount >= (.Rows - 1), rsTemp.RecordCount + 2, .Rows)
                For I = 1 To rsTemp.RecordCount
                    .Row = I
'                    For j = 0 To 1
'                       .Col = j
                        .Col = 0
                        .Text = rsTemp.Fields(0) & ""
'                    Next
                    rsTemp.MoveNext
                Next
            
            End With
        End If
    End With
    jianding.Row = 0
    jianding.Col = 0
    Recount.Text = rsTemp.RecordCount
End Sub
以上代码能实现图片中的效果,我用的是access数据库,有两个表“记录卡”和“台帐”,它们都是以“本厂编号”为主键做关联,现在如何写才能使图片中的其他字段按照相应的“本厂编号”从表“台帐”中查询出来,用循环的方式能实现吗,具体怎么写?谢谢!