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 » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Multiple parameters in a union query



 
 
Thread Tools Display Modes
  #1  
Old August 17th, 2007, 01:55 AM posted to microsoft.public.access
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Multiple parameters in a union query

WHERE [Name] Like "*" & [Enter all or part of employee's name] & "*"
AND [Equipment Type] Like "*" &[Enter equipment type] & "*"

--
KARL DEWEY
Build a little - Test a little


"Karen" wrote:

I have the following union query SQL language that combines four tables into
1. I'd like for the user to be prompted to enter a bit of the employee's
name and then to enter the equipment type for the search.

However, when I run the query, the prompts currently read like this:
prompt 1: Enter all or part of employee's name], 1
prompt 2: Enter all or part of employee's name], 3

I'd like for the prompts to read like this:
prompt 1: Enter all or part of employee's name
prompt 2: Enter equipment type

Here's my language:
SELECT [Name], [Equipment Type], [Equipment #], [Bureau], [Division], [Unit]
FROM [Calling Cards]
WHERE (([Name] Like "*" & [Enter all or part of employee's name] & "*")
AND ([Equipment Type]=[Enter equipment type]))

UNION ALL
SELECT [Name], [Equipment Type], [Equipment #], [Bureau], [Division], [Unit]
FROM [Cell Phones]
WHERE (([Name] Like "*" & [Enter all or part of employee's name] & "*")
AND ([Equipment Type]=[Enter equipment type]))

UNION ALL
SELECT [Name], [Equipment Type], [Equipment #], [Bureau], [Division], [Unit]
FROM [Pagers]
WHERE (([Name] Like "*" & [Enter all or part of employee's name] & "*")
AND ([Equipment Type]=[Enter equipment type]))

UNION ALL SELECT [Name], [Equipment Type], [Equipment #], [Bureau],
[Division], [Unit]
FROM [Vehicles]
WHERE (([Name] Like "*" & [Enter all or part of employee's name] & "*")
AND ([Equipment Type]=[Enter equipment type]))
ORDER BY [Name], [Equipment Type];

How do I get the prompts to read like I want. As well, I'm just learning
about union queries. What other uses may it have.
--
Thanks, Karen

  #2  
Old August 17th, 2007, 01:57 AM posted to microsoft.public.access
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Multiple parameters in a union query

Yes it do. I think Access is looking for what is stored in the field and
not what it is translated to. That is just one of the problems with with
lookups.
You can have a translation table joined in the query and have criteria on
the human side of the translation.
--
KARL DEWEY
Build a little - Test a little


"Karen" wrote:

That's what I thought...until I read the prompt. As my original enquiry
expressed, the prompts do not show what's in the brackets. It never asks me
the question about the Equipment type but when I enter the equipment type in
the second prompt, it reads it as such.

Does it matter that the equipment type field is a lookup instead of a text
field?
--
Thanks, Karen


"KARL DEWEY" wrote:

The prompts are the exact wording you put inside the brackets.
--
KARL DEWEY
Build a little - Test a little


"Karen" wrote:

Thanks Karl. However, the prompts still show up without the language as I
wish. Any other suggestions? The search produces the correct results but I
can't figure why the prompts do not ask accurately for the information.
--
Thanks, Karen


"KARL DEWEY" wrote:

WHERE [Name] Like "*" & [Enter all or part of employee's name] & "*"
AND [Equipment Type] Like "*" &[Enter equipment type] & "*"

--
KARL DEWEY
Build a little - Test a little


"Karen" wrote:

I have the following union query SQL language that combines four tables into
1. I'd like for the user to be prompted to enter a bit of the employee's
name and then to enter the equipment type for the search.

However, when I run the query, the prompts currently read like this:
prompt 1: Enter all or part of employee's name], 1
prompt 2: Enter all or part of employee's name], 3

I'd like for the prompts to read like this:
prompt 1: Enter all or part of employee's name
prompt 2: Enter equipment type

Here's my language:
SELECT [Name], [Equipment Type], [Equipment #], [Bureau], [Division], [Unit]
FROM [Calling Cards]
WHERE (([Name] Like "*" & [Enter all or part of employee's name] & "*")
AND ([Equipment Type]=[Enter equipment type]))

UNION ALL
SELECT [Name], [Equipment Type], [Equipment #], [Bureau], [Division], [Unit]
FROM [Cell Phones]
WHERE (([Name] Like "*" & [Enter all or part of employee's name] & "*")
AND ([Equipment Type]=[Enter equipment type]))

UNION ALL
SELECT [Name], [Equipment Type], [Equipment #], [Bureau], [Division], [Unit]
FROM [Pagers]
WHERE (([Name] Like "*" & [Enter all or part of employee's name] & "*")
AND ([Equipment Type]=[Enter equipment type]))

UNION ALL SELECT [Name], [Equipment Type], [Equipment #], [Bureau],
[Division], [Unit]
FROM [Vehicles]
WHERE (([Name] Like "*" & [Enter all or part of employee's name] & "*")
AND ([Equipment Type]=[Enter equipment type]))
ORDER BY [Name], [Equipment Type];

How do I get the prompts to read like I want. As well, I'm just learning
about union queries. What other uses may it have.
--
Thanks, Karen

 




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 06:40 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.