Solved

Run-time Error 3061

Posted on 2001-07-07
4
144 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
Comment Utility
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
Comment Utility
Try this

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

hongjun
0
 
LVL 22

Accepted Solution

by:
mnasman earned 100 total points
Comment Utility
Hello

  try this

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

Mohammed
0
 
LVL 22

Expert Comment

by:mnasman
Comment Utility
Hello

  try this

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

Mohammed
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now