1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| Public Sub RemplirDataCombo(objConnexion As ADODB.Connection, ValeurRequete As String, NomControl As DataCombo, NomChampAfficher As String, NomCle As String)
On Error GoTo EtiquetteErreur
Dim adoRS As New ADODB.Recordset
Set NomControl.RowSource = Nothing
adoRS.Open ValeurRequete, objConnexion, adOpenKeyset, adLockOptimistic
If Not (adoRS.EOF And adoRS.BOF) Then
adoRS.MoveFirst
Set NomControl.RowSource = adoRS
NomControl.ListField = NomChampAfficher
NomControl.BoundColumn = NomCle
End If
Sortie:
Set adoRS = Nothing
Exit Sub
EtiquetteErreur:
MsgBox Err.Description, , strTitre
GoTo Sortie
End Sub |