Re: Insert statement with errors

Tech-Archive recommends: Fix windows errors by optimizing your registry



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

.



Relevant Pages

  • Re: Error using " in .open with ADODB.Recordset
    ... recordset but I'm getting hung up on the SQL statement. ... query that has a string as a condition. ... Dim mrk As String ...
    (microsoft.public.data.ado)
  • Re: expiration
    ... First what type of field are you applying the criteria against? ... You can try the following in a query. ... If you are trying to get just records with the License has expired within ... it is the actual SQL statement that is executed. ...
    (microsoft.public.access.queries)
  • Re: Same date range in main and sub form
    ... You need to concatenate together the parts to make up the SQL string ... it will look like the SQL statement you original ... Allen Browne - Microsoft MVP. ... well as the name of the query on which the form is based. ...
    (microsoft.public.access.forms)
  • Re: expiration
    ... If you are trying to get just records with the License has expired within ... In the Design view of the query ... This query is based off the existing employee database created by someone ... it is the actual SQL statement that is executed. ...
    (microsoft.public.access.queries)
  • Re: Scroll through records and get match
    ... Doug Steele, Microsoft Access MVP ... "User-defined type not defined" at Dim dbs As DAO.Database. ... that I posted is a select query. ... cannot use it to open an SQL statement that you generate via code. ...
    (microsoft.public.access.modulesdaovba)