Solved

Run-time Error 3061

Posted on 2001-07-07
4
150 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 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

705 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