error problem

  • Thread starter enrico via AccessMonster.com
  • Start date
E

enrico via AccessMonster.com

what's the problem when an error: 'Too few parameters. Expected 1' occurs
when i click my save button? my INSERT statement looks like this:

Dim lngResult as Long
IngResult = DMax("ClientID", "tblGenInfo")

strSql = ("INSERT INTO tblResult(GIID, " & _
" DI, D2, D3, D4, D5," & _
" E1, E2, E3, E4, E5," & _
" F1, F2, F3, F4, F5," & _
" G1, G2, G3, G4, G5," & _
" H1, H2, H3, H4, H5," & _
" I1, I2, I3, I4, I5) " & _
"VALUES (IngResult , " & _
" '" & Me.cboD1 & "', '" & Me.cboD2 & "', '" & Me.cboD3 & "', '" & Me.cboD4 &
"', '" & Me.cboD5 & "', " & _
" '" & Me.cboE1 & "', '" & Me.cboE2 & "', '" & Me.cboE3 & "', '" & Me.cboE4 &
"', '" & Me.cboE5 & "', " & _
" '" & Me.cboF1 & "', '" & Me.cboF2 & "', '" & Me.cboF3 & "', '" & Me.cboF4 &
"', '" & Me.cboF5 & "', " & _
" '" & Me.cboG1 & "', '" & Me.cboG2 & "', '" & Me.cboG3 & "', '" & Me.cboG4 &
"', '" & Me.cboG5 & "', " & _
" '" & Me.cboH1 & "', '" & Me.cboH2 & "', '" & Me.cboH3 & "', '" & Me.cboH4 &
"', '" & Me.cboH5 & "', " & _
" '" & Me.cboI1 & "', '" & Me.cboI2 & "', '" & Me.cboI3 & "', '" & Me.cboI4 &
"', '" & Me.cboI5 & "') ")

Set db = CurrentDb()
db.Execute strSql, dbFailOnError
 
J

Jeanette Cunningham

Hi enrico,
access is trying to tell you that it can't find the value for one of the
controls or variables in the sql.
To find out which one does not have a value, put this line:
-->Debug.Print strSql
at the end of your strSql statement.

-->
"', '" & Me.cboI5 & "') ")
Debug.Print strSql
Set db = CurrentDb()
db.Execute strSql, dbFailOnError


Now run your form normally and click the save button.
Press Ctl+G to open the immediate window.
You will see the query string there with the values for lngResult, cboD1
etc.
You may be able to spot which one is missing a value.
If not, copy and paste the sql string into the Sql view of a new query.
Examine the query in all possible views to see which value(parameter) is
missing.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
D

Dale Fye

Jeanette is being to kind.

The problem is that you have a table that looks like a spreadsheet. Any
time you have field names like the ones you have listed, it is an indication
that your table structure is seriously flawed. And data structure flaws will
guarantee that you are working "harder", not "smarter".

What are all of these fields? Obviously, the "D" fields are all related in
some way, as are the "E" fields, ...

Maybe if you provide some information along these lines, someone here can
provide some guidance about how to improve your table structure and your data
entry process.

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 

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

Top