SQL Statement error

J

James Stephens

What is wrong with this statement. I am getting the error message

Run Time Error 3061
Too few Paramenters. Expected 1.

Dim db As Database, rs As Recordset, strSQL As String

strSQL = "SELECT DISTINCTROW Sum([Calender1 Query].[Requested]) AS
Requested1, Sum([Calender1 Query].[Approved]) AS Approved1, Sum([Calender1
Query].[Denied]) AS Denied1 FROM [Calender1 Query]"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
Value1 = rs![Requested1]
Set rs = Nothing
Set db = Nothing

I can't seem to get this to work, and this is the last piece to my calender.
Any help would be great.

Thanks,

James Stephens
 
T

Tim Ferguson

What is wrong with this statement. I am getting the error message
Run Time Error 3061
Too few Paramenters. Expected 1.

Practically always it's because there is a column name misspelled;
occasionally it's because the query really does have a parameter that one
has forgotten.

I assume it's not "Calender1" since you misspelled that four times!

Hope that helps


Tim F
 
M

Matthias Klaey

What is wrong with this statement. I am getting the error message

Run Time Error 3061
Too few Paramenters. Expected 1.

Dim db As Database, rs As Recordset, strSQL As String

strSQL = "SELECT DISTINCTROW Sum([Calender1 Query].[Requested]) AS
Requested1, Sum([Calender1 Query].[Approved]) AS Approved1, Sum([Calender1
Query].[Denied]) AS Denied1 FROM [Calender1 Query]"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
Value1 = rs![Requested1]
Set rs = Nothing
Set db = Nothing

I can't seem to get this to work, and this is the last piece to my calender.
Any help would be great.

Thanks,

James Stephens

The SQL statement looks ok to me. The error message definitely means
that there is something misspelled (sp?) in your query. I would look
very closely at [Calender1 Query] for spelling errors. For example, is
the name perhaps [Calendar1 Query] ??

HTH
 

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