Bonjour tout le monde
Je vous montre mon problème qui ne doit pas être compliquer à résoudre.
http://imageshack.us/photo/my-images...stitrepgb.png/
J'ai 3 tables access. Je souhaite en vba récupérer la valeur de stock_anomalie dans la table stock_anomalie en fonction du numéros produit et du numéros d'anomalie que j'ai stocker dans des variables VBA
J'arrive à faire la requete sous l assistant access, qui me donne ce code SQL :
1 2 3
| SELECT Stock_anomalie.stock_anomalie
FROM Produit INNER JOIN (anomalie INNER JOIN Stock_anomalie ON anomalie.N°Anomalie = Stock_anomalie.N°Anomalie) ON Produit.N°Produit = Stock_anomalie.N°Produit
WHERE (((anomalie.N°Anomalie)=1) AND ((Produit.N°Produit)=4)); |
Mon problème je n'arrive pas à la transcrire en VBA , j'ai toujours des erreurs. Voici ce que j'ai testé :
Query = " SELECT stock_anomalie FROM Produit INNER JOIN anomalie ON anomlie.N°anomalie = Stock_anomalie.N°Anomalie INNER JOIN Stock_anomalie ON Produit.N°Produit = Stock_anomalie.N°Produit WHERE Produit.N°Produit= " & num_produit & " AND anomalie.N°Anomalie= " & num_casse & ";"
Ou
Query = "Select stock_anomalie FROM Stock_anomalie WHERE Produit.N°Produit = " & num_produit & " AND anomalie.N°anomalie = " & numm_casse & ""
J'espère que vous allez pouvoir m'aider.
Merci
Partager