Re: Insert statement with errors
- From: "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx>
- Date: Sat, 8 Mar 2008 01:15:32 +0900
What's this: (Avril*cGST)
If it is meant to be 2 fields multiplied together, supply an alias for the result:
strSQL = "INSERT INTO BudgetGST ( Idbranch, Avril )" & _
" SELECT Idbranch, [Avril] * [cGST] AS Amount" & _
" FROM GrossMois WHERE GrossMois.IdBranch = " & num & ";"
If IdBranch is a Text field (not a Number field), you need extra quotes.
If that still doesn't solve it, add this line after yours:
Debug.Print strSql
Then when it fails, open the Immediate Window (Ctrl+G), copy the SQL statement output there (Ctrl+C), and paste into SQL View in a new query (Ctrl+V.) Then try to run the query, and see what parameter Access asks for.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Alain" <Alain@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A0522061-2FDE-4820-B031-C4D44F17BA9F@xxxxxxxxxxxxxxxx
Hi, I am getting the error Too few parameters Expected 1 when i try to run
the following SQL statement:
strSQL = "INSERT INTO BudgetGST ( Idbranch, Avril )" & _
" SELECT Idbranch, (Avril*cGST)" & _
" FROM GrossMois WHERE GrossMois.IdBranch = " & num
Avril is a field from GrossMois that contains a value and cGST is a constant.
can anyone tell me what is wrong
Thanks
Alain
.
- Follow-Ups:
- Re: Insert statement with errors
- From: Alain
- Re: Insert statement with errors
- Prev by Date: Re: #Num!
- Next by Date: Re: #Num!
- Previous by thread: Re: #Num!
- Next by thread: Re: Insert statement with errors
- Index(es):
Relevant Pages
|