1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Private Sub btnTestDao_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
' Ouvrir la table vouchComptes
Set db = CurrentDb
Set rst = db.OpenRecordset("vouchComptes", dbOpenTable)
' Choix de l'index de recherche
' (ne fonctione que sur un Recordset de type Table (dbOpenTable)
rst.Index = "PrimaryKey"
rst.Seek "=", 2
' Afficher le compte répondant aux critères
MsgBox ("Numéro = ") & rst("Id_Compte") & _
vbCrLf & rst("Titulaire") & _
vbCrLf & rst("Adresse") & _
vbCrLf & rst("Ville")
' Libérer les objets
rst.Close
Set rst = Nothing
Set db = Nothing
End Sub |
Partager