A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

And Or in a Parameter Query



 
 
Thread Tools Display Modes
  #1  
Old December 17th, 2009, 12:14 AM posted to microsoft.public.access.queries
NEWER USER
external usenet poster
 
Posts: 68
Default And Or in a Parameter Query

How do you make use of AND or OR in a Parameter Query? Entering one value
works fine, but using and/or retrieves an empty string. Any ideas?
  #2  
Old December 17th, 2009, 12:30 AM posted to microsoft.public.access.queries
Phil Smith
external usenet poster
 
Posts: 254
Default And Or in a Parameter Query

A parameter query uses and /or just like any other query as far as I
know. You can't use and / or in the parameter section because you can't
have more then one data type assigned to a field. That is the point
behind a parameter query: Acccess is unable to determine what type of
data is being stored/returned, Currency, Date, whatever, so you use the
parameter to force it to work with that data one consistent way.

However, just because it is a parameter query, does not mean you can not
use and/or in the criteria like you would any other query.

Phil




On 12/16/2009 4:14 PM, NEWER USER wrote:
How do you make use of AND or OR in a Parameter Query? Entering one value
works fine, but using and/or retrieves an empty string. Any ideas?


  #3  
Old December 17th, 2009, 03:14 AM posted to microsoft.public.access.queries
Brian
external usenet poster
 
Posts: 1,396
Default And Or in a Parameter Query

OR: enter each criteria on a separate criteria line
AND: enter all criteria on one criteria line

You will often have combinations, such as this:

Looking up data where the quantity is = 15 and = 25 and the CustomerName
is "JONES" or "SMITH". In this case, JONES goes on one line in the
CustomerName criteria field, SMITH on the one below. The = 15 AND = 25 goes
on EACH line of the Quantity criteria field.

"NEWER USER" wrote:

How do you make use of AND or OR in a Parameter Query? Entering one value
works fine, but using and/or retrieves an empty string. Any ideas?

  #4  
Old December 17th, 2009, 11:19 AM posted to microsoft.public.access.queries
Emma Hope
external usenet poster
 
Posts: 48
Default And Or in a Parameter Query

When the parameter box comes up for you to enter the value, are you typing
your values and 'and/or' in the box i.e. say you wanted 'Fred' or 'Joe' are
you typing Fred or Joe in the parameter box?

If so, you need to put two parameters in your query criteria, i.e.
[Parameter 1] or [Parameter 2], then you will get two boxes, type Fred in the
first and Joe in the second and it will work.

Let us know if any of the answers help you.....



"NEWER USER" wrote:

How do you make use of AND or OR in a Parameter Query? Entering one value
works fine, but using and/or retrieves an empty string. Any ideas?

  #5  
Old December 17th, 2009, 12:42 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default And Or in a Parameter Query

As you can see, there is a little bit of confusion on whether you meant
"I want to enter Joe or Bob as a response to the parameter and have it find
records with Joe or Bob." Or whether you meant " I want to enter Joe in one
parameter prompt and Bob in a second parameter prompt and have records
returned with Joe or Bob."

Parameter prompts contain ONE value. So if you enter "Joe Or Bob" in a
parameter, the search will be for that string and there is probably no record
with "Joe Or Bob" as a value in one field. Parameter prompts cannot contain
conjunctions (and/or) or comparison operators (=,,) or arithmetic
expressions. They can contain strings with those items but they are just
characters in the string and have no effect on what happens in the query.

The best solution in this case is probably to build the query string (or at
least the filter - where clause) using VBA and a form to get the value or values.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Emma Hope wrote:
When the parameter box comes up for you to enter the value, are you typing
your values and 'and/or' in the box i.e. say you wanted 'Fred' or 'Joe' are
you typing Fred or Joe in the parameter box?

If so, you need to put two parameters in your query criteria, i.e.
[Parameter 1] or [Parameter 2], then you will get two boxes, type Fred in the
first and Joe in the second and it will work.

Let us know if any of the answers help you.....



"NEWER USER" wrote:

How do you make use of AND or OR in a Parameter Query? Entering one value
works fine, but using and/or retrieves an empty string. Any ideas?

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:17 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.