Parameter Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am setting up a phone book
I have set up the query [What Company]
When I run the query and the Prompt Box asks for the company name, I cannot
get it to produce any companies that I do not know the correct spelling for

How can I get it to produce company names, Wildcards?????
 
To get wild card in a query use Like + *

In the criteria -
==============
Like "*" & [What Company] & "*"

will return the records that contain the string, any where
==============
Like "*" & [What Company]

will return the records that contain the string, in the end
==============
Like [What Company] & "*"

will return the records that contain the string, in the start
==============
In any of the cases if no string to search is entered, all the records will
be returned
 
If you are going to use a parameter prompt then you could use the LIKE
operator
Field: CompanyName
Criteria: LIKE [What Company?] & "*"

A better solution would be to use a form and a combobox on the form to show
all the company names.

Check out this article for a detailed discussion.
http://www.fontstuff.com/access/acctut08.htm

Or check out this from MS
http://office.microsoft.com/en-us/access/HA011730581033.aspx

A brief quote from a John Vinson (Access MVP) posting.

You'll need to create a small unbound Form (let's call it frmCriteria) with
a Combo Box control (cboCrit) on it. Use the combo box wizard to select the
table for the selections, and be sure that the bound field of the combo is
the value you want to use as a criterion. Save this form.

Now use

=[Forms]![frmCriteria]![cboCrit]

as the criterion in your Query.

It's convenient to base a second Form or Report on the resulting query to
display the results; if you put a button on frmCriteria to launch that form
or report, the user can enter the criterion and view the results in one
simple operation!

Quoting John Vinson

Keywords: Parameter Queries, cascading comboboxes
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top