Insert statement getting "too few parameters, expected 4" errors

G

Guest

Hi all,

I have tried inserting data with the following insert statement in my codes. When this code is executed, I got the error "too few parameters, expected 4". I have no idea where did my sql statement went wrong. Please help me. Thank you!

---start of codes---
Set db = CurrentDb()

StrSQL = "INSERT INTO tblFeesInfo ( IDNo, StudentName, Surname, Item, Description, Rate, Qty, Amount, Address, Names, Today, DueDate, PymtMonth ) SELECT IDNo, StudentName, Surname, Item, Description, Rate, Qty, Amount, Address, (select siblings from tblsiblings where address = qryBasicFees.address) AS [Names], Today, DueDate, PymtMonth FROM qryBasicFees"

db.Execute StrSQL, dbFailOnError
---end of codes---
I've put the above codes in the Report_Active()

Actually [IDNo], [StudentName], [Surname], [Item], [Description], [Rate], [Qty], [Amount], [Address] are all the fields in qryBasicFees.

Whereas [Today], [DueDate], [PymtMonth] are fields in the report that execute this code.
 
A

Arvin Meyer

Have a look at this article on the Access Web:

http://www.mvps.org/access/queries/qry0013.htm
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

yann said:
Hi all,

I have tried inserting data with the following insert statement in my
codes. When this code is executed, I got the error "too few parameters,
expected 4". I have no idea where did my sql statement went wrong. Please
help me. Thank you!
---start of codes---
Set db = CurrentDb()

StrSQL = "INSERT INTO tblFeesInfo ( IDNo, StudentName, Surname, Item,
Description, Rate, Qty, Amount, Address, Names, Today, DueDate, PymtMonth )
SELECT IDNo, StudentName, Surname, Item, Description, Rate, Qty, Amount,
Address, (select siblings from tblsiblings where address =
qryBasicFees.address) AS [Names], Today, DueDate, PymtMonth FROM
qryBasicFees"
db.Execute StrSQL, dbFailOnError
---end of codes---
I've put the above codes in the Report_Active()

Actually [IDNo], [StudentName], [Surname], [Item], [Description], [Rate],
[Qty], [Amount], [Address] are all the fields in qryBasicFees.
Whereas [Today], [DueDate], [PymtMonth] are fields in the report that
execute this code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top