?
Solved

Run-time Error 3061

Posted on 2001-07-07
4
Medium Priority
?
151 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 400 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

752 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