mercredi 27 janvier 2021

VBA: ADODB with checkbox for output value

I run the ADODB query, the values of my variables are 0 and 1. In the place of my values I would like to have the checkbox enter image description here, but I don't know how to add it to my query.

My code is:

Public Sub INFO_PROTO(NO_POLICE As String)

Dim RECSET As New ADODB.Recordset
RECSET.Open "select proto.b_perf_cma as b_perf_cma, proto.b_perf_supp_ann as b_perf_supp_ann, proto.b_perf_ctrat_gar as b_perf_ctrat_gar from db_dossier sousc, db_produit prod, db_protocole proto" & _
            " where sousc.no_police = '" & NO_POLICE & "' and sousc.cd_dossier = 'SOUSC' and sousc.lp_etat_doss not in ('ANNUL','A30','IMPAY') and sousc.is_produit = prod.is_produit and sousc.is_protocole = proto.is_protocole ", cnn_Pegase, adOpenDynamic, adLockBatchOptimistic
If Not RECSET.EOF Then
    Worksheets("1 - Feuille de Suivi Commercial").Range("test").Value = RECSET.Fields("b_perf_cma").Value
    Worksheets("1 - Feuille de Suivi Commercial").Range("test2").Value = RECSET.Fields("b_perf_supp_ann").Value
    Worksheets("1 - Feuille de Suivi Commercial").Range("test3").Value = RECSET.Fields("b_perf_ctrat_gar").Value
Else
   Worksheets("1 - Feuille de Suivi Commercial").Range("test").Value = "NC"
    Worksheets("1 - Feuille de Suivi Commercial").Range("test2").Value = "NC"
    Worksheets("1 - Feuille de Suivi Commercial").Range("test3").Value = "NC"
End If
RECSET.Close

End Sub




Aucun commentaire:

Enregistrer un commentaire