2010-03-16 3 views

Répondre

1

Vous pouvez utiliser le ou recordset recordsetclone.

With Me.Recordsetclone 
    .MoveFirst 
    Do While Not .EOF 
     MsgBox "Field 1 is: " & .Fields(1) 
     .MoveNext 
    Loop 
End with 

Vous pouvez également permettre à l'utilisateur de mettre en évidence les enregistrements et travailler avec ceux (http://support.microsoft.com/kb/208502).

Function DisplaySelectedCompanyNames() 
    Dim i As Long 
    Dim frm As Form 
    Dim rs As DAO.Recordset 

    '' Get the form and its recordset. 
    Set frm = Forms![Customers] 
    Set rs = frm.RecordsetClone 

    '' Move to the first record in the recordset. 
    rs.MoveFirst 

    '' Move to the first selected record. 
    rs.Move frm.SelTop - 1 

    '' Enumerate the list of selected records presenting 
    '' the CompanyName field in a message box. 
    For i = 1 To frm.SelHeight 
     MsgBox rs![CompanyName] 
     rs.MoveNext 
    Next i 

    End Function 
Questions connexes