Access穫取子窗體多選記録的值

2018-09-12 16:08:00
黃善超
原創
588

在Access中,子窗體作爲記録集作用很明顯,前麵我們也講過很多關於穫取子窗體的值的問題

Access穫取子窗體選擇的值

Access在父窗體中穫取選中子窗體的值


那麽如何穫取多條子窗體的記録呢?如下圖,我們選中多條記録


穫取多條記録的值結果


數據錶視圖中窗體多選時選定的記録條數爲Me.SelHeight屬性,然後循環穫取數據

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim I As Long
    Dim lRows As Long
    Dim s As String
    lRows = Me.SelHeight
    For I = 1 To lRows
'        MsgBox Me.Recordset.Fields(2)
        s = Me.Recordset.Fields(2) & ";" & s
        
        Me.Recordset.MoveNext
    Next
    MsgBox s
End Sub


    分享