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. |
|
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
three query union.
I don't understand why you are using a union query at all. This query
would apparently give you the same results with less trouble. SELECT [GENERAL MAILING LIST].FirstName , [GENERAL MAILING LIST].LastName , [GENERAL MAILING LIST].EmailAddress , True as ReturnTrue FROM [GENERAL MAILING LIST] WHERE [GENERAL MAILING LIST].EmailAddress Like "*@*" AND ([GENERAL MAILING LIST].SA=True OR [GENERAL MAILING LIST].[PG]= True OR [GENERAL MAILING LIST].[RC] = True) '================================================= === John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County '================================================= === Thomas wrote: SELECT [GENERAL MAILING LIST].FirstName, [GENERAL MAILING LIST].LastName, [GENERAL MAILING LIST].EmailAddress, [GENERAL MAILING LIST].SA FROM [GENERAL MAILING LIST] WHERE ((([GENERAL MAILING LIST].EmailAddress) Like "*@*") AND (([GENERAL MAILING LIST].SA)=Yes)) UNION SELECT [GENERAL MAILING LIST].[FirstName], [GENERAL MAILING LIST].[LastName], [GENERAL MAILING LIST].[EmailAddress], [GENERAL MAILING LIST].[PG] FROM [GENERAL MAILING LIST] WHERE ((([GENERAL MAILING LIST].[EmailAddress]) Like "*@*") AND (([GENERAL MAILING LIST].[PG])=Yes)) UNION SELECT [GENERAL MAILING LIST].[FirstName], [GENERAL MAILING LIST].[LastName], [GENERAL MAILING LIST].[EmailAddress], [GENERAL MAILING LIST].[RC] FROM [GENERAL MAILING LIST] WHERE ((([GENERAL MAILING LIST].[EmailAddress]) Like "*@*") AND (([GENERAL MAILING LIST].[RC])=Yes)); "Jerry Whittle" wrote: Show us the SQL. Open the query in design view. Next go to View, SQL View and copy and past it here. -- Jerry Whittle, Microsoft Access MVP Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder. "Thomas" wrote: Trying to make a three querry, but every time I try I get an error message that MS Accesss DB can't find object ". I have 4 querries They all work & they all work in combinations of two, but not three? Thomas |
#12
|
|||
|
|||
three query union.
Now it asks for Paramater General. I'm I doing something wrong when I try to
create a new query? Think I will start a new post & start w/what I'm trying to do. Get a fresh start to my problem. "John W. Vinson" wrote: On Wed, 8 Jul 2009 16:28:01 -0700, Thomas wrote: Now it asks for a Parameter for SA. Your first query was SELECT [GENERAL MAILING LIST].FirstName, [GENERAL MAILING LIST].LastName, [GENERAL MAILING LIST].EmailAddress, [GENERAL MAILING LIST].SA FROM [GENERAL MAILING LIST] WHERE ((([GENERAL MAILING LIST].EmailAddress) Like "*@*") AND (([GENERAL MAILING LIST].SA)=Yes)) Is there in fact a field named SA in your table? If not you'll get the parameter prompt. Also using the UNION will keep out the duplicates. If there's only one record for each person, you won't get duplicates. Your UNION query will retrieve the same record three times if all three checkboxes are checked, but the WHERE clause will retrieve the record only once if any (or all) of the checkboxes are checked. If you can have the same name and email address multiple times in the table you can use SELECT DISTINCT to eliminate duplicates. -- John W. Vinson [MVP] |
#13
|
|||
|
|||
three query union.
Thank you for your help. I've reposted with more info. It is titled:
UNION, WHERE or Something else? If you have suggestion would be greatly appreciated. Thomas "John W. Vinson" wrote: On Wed, 8 Jul 2009 16:28:01 -0700, Thomas wrote: Now it asks for a Parameter for SA. Your first query was SELECT [GENERAL MAILING LIST].FirstName, [GENERAL MAILING LIST].LastName, [GENERAL MAILING LIST].EmailAddress, [GENERAL MAILING LIST].SA FROM [GENERAL MAILING LIST] WHERE ((([GENERAL MAILING LIST].EmailAddress) Like "*@*") AND (([GENERAL MAILING LIST].SA)=Yes)) Is there in fact a field named SA in your table? If not you'll get the parameter prompt. Also using the UNION will keep out the duplicates. If there's only one record for each person, you won't get duplicates. Your UNION query will retrieve the same record three times if all three checkboxes are checked, but the WHERE clause will retrieve the record only once if any (or all) of the checkboxes are checked. If you can have the same name and email address multiple times in the table you can use SELECT DISTINCT to eliminate duplicates. -- John W. Vinson [MVP] |
#14
|
|||
|
|||
three query union.
Thank you for your help. I've reposted with more info. It is titled:
UNION, WHERE or Something else? If you have suggestion would be greatly appreciated. Thomas "Gina Whipp" wrote: Thomas, It will help us see what you see if you post the SQL of the query that is not working. -- Gina Whipp "I feel I have been denied critical, need to know, information!" - Tremors II http://www.regina-whipp.com/index_files/TipList.htm "Thomas" wrote in message ... Trying to make a three querry, but every time I try I get an error message that MS Accesss DB can't find object ". I have 4 querries They all work & they all work in combinations of two, but not three? Thomas |
|
Thread Tools | |
Display Modes | |
|
|