Bonjour,
Lorsque je lance le code suivant j'obtiens une erreur 3061, Trop peu de paramètres : 2 attendu sur la ligne
Set pdt = CurrentDb.OpenRecordset(mySQL2)
J'avoue que je ne vois pas pourquoi.
Est-ce quelqu'un pourrait m'éclairer.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
Option Compare Database
Option Explicit
Public Sub gestionstock()
Dim mySQL1 As String, mySQL2 As String, mySQL3 As String, mySQL4 As String
Dim pdt As DAO.Recordset, inv As DAO.Recordset, bl As DAO.Recordset
DoCmd.SetWarnings False
' Supprime les données de la table T Gestion stock
mySQL1 = "DELETE * from [T Gestion stock]"
DoCmd.RunSQL (mySQL1)
' Sélectionne les articles gérés en stock et leurs conditionnements associés
mySQL2 = "SELECT [Liste articles].[Code article], Artcondt.[Conditionnement 1]"
mySQL2 = mySQL2 + " FROM [Liste articles] INNER JOIN [Artcondt] ON [Liste articles].[Code article] = [Artcondt].[Code article]"
mySQL2 = mySQL2 + " WHERE ((([Liste articles].[Code article]) Not Like 'Z*' And ([Liste articles].[Code article])"
mySQL2 = mySQL2 + " Not Like 'transport*' And ([Liste articles].[Code article]) Not Like 'XXX*' And"
mySQL2 = mySQL2 + " ([Liste articles].[Code article]) Not Like 'A*') AND (([Liste articles].[Article fermé (O/F)])='O')"
mySQL2 = mySQL2 + " AND (([Liste articles].[Article privilégié O/N])='O')) ORDER BY [Liste articles].[Code article]"
' Ouvre le Recordset pdt
Set pdt = CurrentDb.OpenRecordset(mySQL2)
While Not pdt.EOF
mySQL3 = "SELECT [a] FROM [R AC bl] WHERE [Code produit] = '" & pdt.Fields(0).Value & "' AND"
mySQL3 = mySQL3 + " [Code conditionnement] = '" & pdt.Fields(1).Value & "'"
Debug.Print (mySQL3)
Set bl = CurrentDb.OpenRecordset(mySQL3)
If bl.BOF = True And bl.EOF = True Then
bl.Fields(0).Value = "0"
pdt.MoveNext
Else |
Partager