OpenRecordset avec variable
Bonjour, est-il possible d'utiliser une variable pour définir le champs dans laquelle la donnée sera extraite.
Exemple qui ne fonctionne pas: ligne.fields ("champsvar").value
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| Dim champsvar As String
champsvar = Article_TT.Value
Set base = Application.CurrentDb
Set ligne = base.OpenRecordset("Select * FROM Personnel WHERE Matricule = '" & FTMatricule.Value & "' ", dbOpenDynaset)
ligne.MoveFirst
FTRefTaille.Value = ligne.Fields("champsvar").Value
ligne.Close
base.Close
Set ligne = Nothing
Set base = Nothing |