Bonjour,

Je m'y connais pas du tout en VBA, bien que j'essaie de m'y mettre. en fait, j'ai une requête sql qui fait des comparaison entre différent champs, et en résultat tout simplement j'aimerai savoir comment faire pour transformer cette requête en macro d'une part qui se connecte à une base sql, et d'autre part qui met des couleurs en sortie de requête pour excel quand la requete ramène un resultat incorrect. exemple requête ci-dessous:

Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
select (case when a.ccf=b.ccf then 'Y' else 'N' end) CCFV10_egal_CCFV5
,(case when a.rw_new=b.rw_new then 'Y' else 'N' end) RWnewV10_egal_RWnewV5
,(case when a.rgc=(((a.ead-a.ead_pro)*a.rw_new)*8/100) then 'Y' else 'N' end) RgcV10recalc_egal_RgcV10
,(case when b.rgc=(((b.ead-b.ead_pro)*b.rw_new)*8/100) then 'Y' else 'N' end) RgcV5recalc_egal_RgcV5
,(case when a.ead_pro=b.ead_pro then 'Y' else 'N' end) ProvisionV5_egal_ProvisionV10
,(case when a.asset_class_new=b.asset_class_new then 'Y' else 'N' end) Recl_A_V10_egal_Recl_A_V5
,(case when a.bis_entity_type_new=b.bis_entity_type_new then 'Y' else 'N' end) Recl_B_V10_egal_Recl_B_V5
,a.bs_type bs_type_V10, b.bs_type bs_type_V5
from (select * from toto) a
join (select * from toto.t_cdr) b 
 on a.contract_reference = b.contract_reference
and a.tranche_collateral_type = b.tranche_collateral_type
and a.tranche_guarantee_type = b.tranche_guarantee_type
and a.ead_pre_ccf = b.ead_pre_ccf 
and a.rgc <> b.rgc

Merci de votre aide