Solved

Run-time Error 3061

Posted on 2001-07-07
4
148 Views
Last Modified: 2006-11-17
Why does the following line give me an error?
Set rst = mydb.OpenRecordset("SELECT * FROM People WHERE Name LIKE Tim", dbOpenDynaset)

The exact error is:
Run-time Error 3061
Too few parameters, Expected 1.

How do I fix it?

I want to be able to pull up all records from the table people that have values in the name field like Tim (i.e.; Timothy, Timmy, etc)....all fields to the records as well, NOT just the name field

Thanks!
0
Comment
Question by:groone
  • 2
4 Comments
 
LVL 1

Expert Comment

by:kirthir
ID: 6261992
Change the qry to something like

"SELECT * FROM People WHERE Name LIKE ""Tim*"" "  (starting with Tim)

If you want "Tim" anywhere in the name field then change the query to

"SELECT * FROM People WHERE Name LIKE ""*Tim*"" "  (Tim anywhere in the field)

For a double-quote another double-quote will act as escape character

IF THIS DOESN'T WORK CHANGE * with % in the query and try.

All the best
0
 
LVL 33

Expert Comment

by:hongjun
ID: 6262007
Try this

Set rst = mydb.OpenRecordset("SELECT * FROM People WHERE Name LIKE 'Tim%'", dbOpenDynaset)

hongjun
0
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 100 total points
ID: 6262068
Hello

  try this

Set rst = mydb.OpenRecordset("SELECT * FROM People WHERE Name LIKE 'Tim*' ", dbOpenDynaset)

Mohammed
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6262097
Hello

  try this

Set rst = mydb.OpenRecordset("SELECT * FROM People WHERE Name LIKE 'Tim*' ", dbOpenDynaset)

Mohammed
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question