newbie problem with libraries and syntax

M

Matilda

A typical newbie brick wall....
I cannot get code copied from a reference book, or this group, to execute
without error messages.

Can anyone tell me why this is giving me an error?

Function Episodes_List() As Recordset
'This opens a recordset from the Table [Name]

Dim strSQL As String
Dim wksp As DAO.Workspace
Dim db As DAO.Database
Dim rst As DAO.Recordset

Set db = OpenDatabase("AllTheData")
Set db = CurrentDb
Debug.Print db.Name
strSQL = "SELECT AllTheData.EID,AllTheData.SellDate FROM AllTheData " & _
"WHERE (AllTheData.SellDate > #01/02/2008# );"
Set Episodes_List = db.OpenRecordset(strSQL)


The last line gives an error message saying
'Runtime error 3061, Too few parameters. Expected 1'


I am using DAO 3.6 Object Library and it is above the ADO library reference.
Can't figure out what the problem is and I can't write another line of code
until I find it :-(((

Many TIA's for any advice, Matilda
 
M

Matilda

Thanks, Alex!!!

I was focussing on trying to work out the meaning of the error message, and
didn't think to check that I had the attributes of the table spelled
correctly in the sql string - that was where the mistake was indeed!

Many, many thanks.

Hi,
check that AllTheData query has EID and SellDate fileds, also try to open it
manually and make sure it does not ask for parameters

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com

Matilda said:
A typical newbie brick wall....
I cannot get code copied from a reference book, or this group, to execute
without error messages.

Can anyone tell me why this is giving me an error?

Function Episodes_List() As Recordset
'This opens a recordset from the Table [Name]

Dim strSQL As String
Dim wksp As DAO.Workspace
Dim db As DAO.Database
Dim rst As DAO.Recordset

Set db = OpenDatabase("AllTheData")
Set db = CurrentDb
Debug.Print db.Name
strSQL = "SELECT AllTheData.EID,AllTheData.SellDate FROM AllTheData " & _
"WHERE (AllTheData.SellDate > #01/02/2008# );"
Set Episodes_List = db.OpenRecordset(strSQL)


The last line gives an error message saying
'Runtime error 3061, Too few parameters. Expected 1'


I am using DAO 3.6 Object Library and it is above the ADO library
reference.
Can't figure out what the problem is and I can't write another line of
code
until I find it :-(((

Many TIA's for any advice, Matilda
 

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