strSQL ---> "Too few parameter,expected 1"

S

shiro

Last time,below strSQL work fine for me but now,
it send error:
Too few parameter,expected 1.
Please help to find out which parameter is less.
Thank's

Shiro

strSQL = "SELECT TOP 10 " & vbCrLf & _
" Format([Date],""mmm"") AS [Month] " & vbCrLf &
_
" , Format([Date],""yyyy"") AS [Year] " & vbCrLf
& _
" , Model " & vbCrLf & _
" , Sum([" & [CboRejectItem].Column(0) & _
"]) AS [NG Qty]" & vbCrLf & _
" INTO [The Worst 10 by Reject Item tbl] " &
vbCrLf & _
" FROM [DC Fan Information Centre] " & vbCrLf &
_
" WHERE Format([Date],""mmm"")=""" &
Me.[cboMonth] & """" & vbCrLf & _
" AND Format([Date],""yyyy"")=""" & Me.[cboYear]
& """ " & vbCrLf & _
" GROUP BY Format([Date],""mmm"") " & vbCrLf & _
" , Format([Date],""yyyy"") " & vbCrLf & _
" , Model " & vbCrLf & _
" ORDER BY Sum([" & [CboRejectItem].Column(0) &
"]) DESC " & vbCrLf & _
" WITH OWNERACCESS OPTION;"
 
R

rm

I do not have an exact answer - that error can be thrown if you have a
mis-typed field name.

Use the immediate window (or the locals window) & a break point. Set a
break point on the line you described below. Set through the line
"strSQL =...". In the immediate window enter "?strSQL" then press the
enter key. The SQL statement that you have constructed will be
displayed in the immediate window. Analyze the SQL statement. Also,
take the value of strSQL and place it into a new query (from the SQL
view of a query). See what happens upon execution.
 
S

shiro

Aaah....
you're right rm,
I forget to edit the strSQL after I modified the [Date] field name.
Thank's alot for both of you,
the response waked me up.
Rgds,

Shiro


I do not have an exact answer - that error can be thrown if you have a
mis-typed field name.

Use the immediate window (or the locals window) & a break point. Set a
break point on the line you described below. Set through the line
"strSQL =...". In the immediate window enter "?strSQL" then press the
enter key. The SQL statement that you have constructed will be
displayed in the immediate window. Analyze the SQL statement. Also,
take the value of strSQL and place it into a new query (from the SQL
view of a query). See what happens upon execution.
 

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