Compilation error: expected: list separator or ) [Access/Vba]
Solved
Gnyss
-
Gnyss -
Gnyss -
Hello,
I have been encountering difficulties for a few days now, and I really need your help. Let me explain the situation:
Actually, I am just starting out with Access and I am trying to design an application, part of which will allow me to manage stock entries. But before getting there, what I would like to do first is to obtain the brand of the product and its quantity from the reference selected in a drop-down list.
Here is the VBA code:
Dim enrg As Recordset: Dim base As Database
Set base = Application.CurrentDb
Set enrg = base.OpenRecordset("SELECT marque, qteprod FROM produit WHERE idprod='"&Modifiable18.Value&"';", dbOpenDynaset)
qtemaj.Value = 0: qteac.Value = 0
enrg.MoveFirst
marque.Value = enrg.Fields("marque").Value
qteac.Value = enrg.Fields("qteprod").Value
qtemaj.SetFocus
enrg.Clone
base.Close
Set enrg = Nothing
Set base = Nothing
The problem is that the following error message appears every time I run the code: "compilation error: expected: list separator or )" and the cursor is positioned at the line:
Set enrg = base.OpenRecordset("SELECT marque, qteprod FROM produit WHERE idprod='"&Modifiable18.Value&"';", dbOpenDynaset)
Not knowing exactly where the problem lies, could you please help me!
Thank you in advance!!!
I have been encountering difficulties for a few days now, and I really need your help. Let me explain the situation:
Actually, I am just starting out with Access and I am trying to design an application, part of which will allow me to manage stock entries. But before getting there, what I would like to do first is to obtain the brand of the product and its quantity from the reference selected in a drop-down list.
Here is the VBA code:
Dim enrg As Recordset: Dim base As Database
Set base = Application.CurrentDb
Set enrg = base.OpenRecordset("SELECT marque, qteprod FROM produit WHERE idprod='"&Modifiable18.Value&"';", dbOpenDynaset)
qtemaj.Value = 0: qteac.Value = 0
enrg.MoveFirst
marque.Value = enrg.Fields("marque").Value
qteac.Value = enrg.Fields("qteprod").Value
qtemaj.SetFocus
enrg.Clone
base.Close
Set enrg = Nothing
Set base = Nothing
The problem is that the following error message appears every time I run the code: "compilation error: expected: list separator or )" and the cursor is positioned at the line:
Set enrg = base.OpenRecordset("SELECT marque, qteprod FROM produit WHERE idprod='"&Modifiable18.Value&"';", dbOpenDynaset)
Not knowing exactly where the problem lies, could you please help me!
Thank you in advance!!!
thank you for your response, I just modified the line by placing spaces before and after the &. But now another error message is displayed:
"runtime error '3464': incompatible data types in the criterion expression."
Thanks again! :-)]