Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 22nd, 2004, 04:09 PM
Authorized User
 
Join Date: Aug 2004
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default Parameter Query

Hello All,
I have a new question about parameter queries. I have several of them created and two in particular are the ones I am interested in. When the person that I am creating this database for runs one of these queries, it prompts him to enter the IP Address of choice. It will find the IP Address if he types the whole IP Address in, however, if he wants to search for all IP Addresses that start with 192.210.63 it will come up blank. Is there a way I can modify this parameter query so it will let him narrow his search in this manner? Thanks for the help everyone. It seems as though some of you may have been annoyed with all the questions I have asked in the past and I am sorry if I have caused any hard feelings among the site members. However, I don't know everything and this site has been a big help to me.



 
Old October 22nd, 2004, 04:29 PM
Authorized User
 
Join Date: Oct 2004
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use the LIKE predicate and add a wildcard like this:

WHERE IPAddress LIKE [Enter IP Address:] & "*"

John Viescas, author
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
 
Old October 22nd, 2004, 05:55 PM
Authorized User
 
Join Date: Aug 2004
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank You. That was the solution.

 
Old November 11th, 2004, 06:54 PM
Authorized User
 
Join Date: Aug 2004
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Okay that works. But here is another issue. I have been experimenting with this to no avail. I put my database into production today. The user opened one of the queries and it prompted him for the name of the Printer ID he wanted to view. The parameter query has the following criteria: Like [What Printer ID Would You Like To View?] & "*". He typed in JD234A and it gave him all of the JD printers that start with "A"...EXAMPLE....JD234AA,JD234AB etc...If he types in JD234A he wants to be able to look at just that one printer and also still be able to search for all printers that begin with "JD" if the need arises. Can you help me figure out how to modify my parameter query to make this happen?

 
Old November 11th, 2004, 07:21 PM
Authorized User
 
Join Date: Oct 2004
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There is no solution with a single parameter query. To give the user the option to do a search or an exact match, you'll need to build a form. Provide a text box where the user can type the printer name and an option button the user can select if he or she wants an exact match. Remove the parameter from the record source of the form or report that displays the result. In the click event of a command button you provide, build the predicate in a string using Like and the wildcard if the user wants a "begins with" search or use equals (=) and no wildcard if the user selects the exact match option. Use DoCmd.OpenForm or DoCmd.OpenReport with the predicate string specified in the WhereCondition parameter.


John Viescas, author
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"





Similar Threads
Thread Thread Starter Forum Replies Last Post
Parameter Query Help Normie Access 5 February 19th, 2008 01:50 PM
passing parameter to query vladimir Access 6 August 30th, 2006 05:39 AM
XSL - Parameter query. Neal XSLT 4 January 24th, 2006 01:27 PM
Non query Report Parameter qa BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 July 2nd, 2004 02:49 PM
Parameter Query Ben Access VBA 1 June 27th, 2003 12:13 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.