View Full Version : Help! - Runtime Error 3061:Too Few parameters Expected


CBO
08-08-2005, 10:54 AM
Can someone help me:

I'm not sure what I'm doing wrong, can someone please help me out.
I get a runtime error 3061: Too few parameters Expected 1 when I run the following code below.

Dim rst As DAO.Recordset

Set rst = CurrentDb.OpenRecordset("SELECT * FROM [FRL Codes] WHERE [20YR] like EQPAR132;")

****NOT USING A FORM, JUST WANT TO SELECT FROM A TABLE****

Thanks
CBO

WayneRyan
08-08-2005, 11:25 AM
CBO,

What is EQPAR132?

If it is a constant:

Set rst = CurrentDb.OpenRecordset("SELECT * FROM [FRL Codes] WHERE [20YR] = 'EQPAR132';")

If it is a form variable equating to a string:

Set rst = CurrentDb.OpenRecordset("SELECT * FROM [FRL Codes] WHERE [20YR] = '" & Me.EQPAR132 & "';")

If you really want to use Like, you need a wildcard:

Set rst = CurrentDb.OpenRecordset("SELECT * FROM [FRL Codes] WHERE [20YR] Like '*EQPAR132*';")

Need more info,
Wayne

CBO
08-08-2005, 11:42 AM
The first one worked just by adding the single quotes....You rock!!


:) Thanks CBO