General :: Union With Select And Crosstab Query

Oct 9, 2013

I am trying to get a report that shows both column totals and row totals.

I have a crosstab query that gives me the Row totals along with the crosstab data.

I have read on a previous post [URL] ....

That I can union the crosstab to a select query which should get me what I want, but to be honest I am lost.

View Replies


ADVERTISEMENT

Union Select Query (What Am I Doing Wrong)

May 28, 2006

Please see attached database

If you open the form called people you will see a command button
Called add charge once pressed will open a form called charge

On the Bill To combo Box I have the following Union Select Query

SELECT PrimaryInsurance, PersonID FROM tblpeople UNION Select SecondaryInsurance, PersonID FROM tblPeople

What I want the bill to combo box to display is only the Insurances that are related to the
Patient that the charge is for and not to display other patients insurances


Any Ideas

View 2 Replies View Related

Union Query - Possible For User To Select Tables ?

Jun 28, 2006

I have Access2003 and a problem creating a simple method of constructing a union query.

I am using a commercial paradox databse that has a habit of creating a new table every time a certain action is performed. There is currently a set of 160 tables with identical fields. The database allows me to view data in these tables individually. I would like to pull the information together, from between 20 and 30 specific tables at any one time, and view the data in one table.

I have linked the tables in a an access database and would go about viewing the data by creating a union query containing each of the tables of interest. Then appending the info in these tables to a new table.

Unfortunately manually adjusting the SQL expression is a bit cumbersome to say the least I am wondering if it possible to select the tables of interest from a List Box on a simple form and have those selected inserted into the union query ?

Alternatively, the table names are actually a field within a different table. Another field within this table actually determines whether they will be of interest. So ideally I could query that table to tell me which tables need to appear in the union query. Again I would like the union query generated automatically as a result of that query.

I am confident, perhaps without good reason , that this must be possible ....

any help much appreciated.

View 14 Replies View Related

Crosstab Qry From Union Qry

Dec 6, 2005

I have a UNION qry in which I have Out, Incoming and internal invoices as RELATIONSHIPs, and based on it a CROSSTAB qry, and now there are 2 new categories which are goods that were returned - and there are 2 because:
1. is return from Internal and
2. is return from Outgoing invoices.
I need to calculate the current InStock (based on articalNumbers) with this in mind:
InStock = Incoming - OUTgoing - Internal + returnfromInternal + returnFromOutgoing

However, I cant seem to get a returns to the same crosstab qry in order to include them in calculation

the real names of variables are not important but the principle on which I should base my qry is the problem for me (please have in mind that I first started working in access about 2 months ago)
Is there anything wrong with the principle of my work here?
t i a...

View 1 Replies View Related

Union Query - Generating From A Select Query ?

Jun 23, 2006

(This is a modified repost - which hopefully makes sense) I am using Access2003. I am trying to set up a fast method of creating a union query. I have a jobs table that stores info about jobs with a separate table for each job that pulls together info from elsewhere when a review is conducted. The tables are as follows (and are linked from a paradox DB) :-

Table Name: jobs
JobID (J000001, J000002, etc)
Status (Live, Filled, etc)

Review Tables

Table Name: J000001 / J000002 etc
Consultant: (Joe, Terry etc)
ObjectID: (RoberI, SmithJ etc)
Status: (H, P, D, R etc)

The jobs table contains information about jobs, including a unique code (JobID) that identifies the job. There is also a status filed that tells us whether the job is Live or closed etc.

The first time a job is reviewed a new table, a review table is generated, and the name of the table is the same as the JobID for that job. So Job J000001 has a review table with table name J000001 etc. The review tables may contain information with the same ObjectID (as they are unique fields from a third table – the candidates table)

I would like to generate a union query for all jobs in table jobs with a status of live. I can do this manually, if I review a list of live jobs, with the following sql expression;

SELECT ObjectID, Consultant, Status, "J000001"
as [JobNo] FROM J000001
UNION SELECT ObjectID, Consultant, Status, "J000002"
as [JobNo] FROM J000002
UNION SELECT ObjectID, Consultant, Status, "J000003"
as [JobNo] FROM J000003;

I can then append the info into a new table. However this query is run at least twice a day and things change.

I would like to know is there a means of automatically generating sql for the union query based on results of a query of the jobs table ?

Any help greatly appreciated.

View 2 Replies View Related

Bug With Wrapper Select Query On A Union Query

Sep 14, 2007

I have the following query:

SELECT UnionTable.groupby, UnionTable.SeqID, UnionTable.Actual
FROM (

SELECT VAP1.groupby, VAP1.SeqID, VAP1.SomVanbedrag as Actual
FROM qryVoorplaatActualPillar_Forecast AS VAP1

UNION

SELECT VAP2.groupby, VAP2.SeqID, VAP2.SomVanbedrag as Actual
FROM qryVoorplaatActualPillarIST_Forecast AS VAP2) AS UnionTablewhich is two select queries called UnionTable and a wrapper.
Access handles this very well. Until you look at the SQL statement. If you don't pay attention Access stores the next query
SELECT UnionTable.groupby, UnionTable.SeqID, UnionTable.Actual
FROM [

SELECT VAP1.groupby, VAP1.SeqID, VAP1.SomVanbedrag as Actual
FROM qryVoorplaatActualPillar_Forecast AS VAP1

UNION

SELECT VAP2.groupby, VAP2.SeqID, VAP2.SomVanbedrag as Actual
FROM qryVoorplaatActualPillarIST_Forecast AS VAP2]. AS UnionTable
Now when you want to execute the query you get an errormessage.
Has anyone seen this before? Is this a known bug or is it a feature? Is there a workaround?

View 1 Replies View Related

Crosstab Query Built On A Select Query

Jun 18, 2015

I have a crosstab query built on a select query.It works perfect. However, when I try to use the "Between [BegDate] And [EndDate]" it tells me access engine can not recognize it.If I use this in the actual select query it works fine. But when I try to use the crosstab query it gives me the above error.

Also, I'm using two undbound textboxes on a form for [BegDate] and [EndDate]. I have the syntax correct in my select query and it works fine. But it won't work with the crosstab query.

View 3 Replies View Related

General :: Union Query And Form Coding

May 14, 2013

I have 2 tables, (will just call them tbl1 and tbl2 for this example) each with a column AppNumber. The AppNumber may appear in both tables or individually in either one.

I want to be able to show, or flag, on a continuous form which Appnumber's appear on tbl1, tbl2 and on both. This is so the user can click a button and bring up another form with more data relevant to the AppNumber.

I have written a union query to show all results from both tbl1 and tbl2 which contains 4 fields AppNumber, DateApp, Surname, Forename but I can't tell from the query results what AppNumber's appear on each table. Here's what I would like to show on the continuous form:

AppNumber DateApp Surname Forename tbl1 tbl2 Both
12345 11/12/2012 Simpson Homer Yes No No
56565 01/04/2013 Stallone Sly No Yes No
89788 03/03/2012 Rambo John Yes Yes Yes
89745

View 2 Replies View Related

Help With A UNION Select Please

Sep 15, 2005

I have a query that requires a selection from my list box "[Forms]![ViewReports]![ListFilterName]"

I have a list box with a UNION so that I can query all contacts. The bound column is one.

SELECT 0,"<<ALL","TEAM MEMBERS>>" from Contacts UNION (SELECT Contacts.ID, Contacts.[First Name], Contacts.[Last Name] FROM Contacts ORDER BY [Last Name]);

Problems

The list is not ordering by last name.

The query does not assume all contacts when "<<ALL","TEAM MEMBERS>>" is selected.

Where did I go wrong? What's missing?

View 2 Replies View Related

Queries :: UNION / UNION ALL Query Crashed Access

Oct 24, 2013

I'm having a problem with a UNION / UNION ALL query.It seems there is a application crash fault when running the query that MS are aware of and have issued a hot fix. Unfortunately it will take my IT dept some time to check and install the hot fix If they agree to do it at all.

Problem signature:
Problem Event Name: APPCRASH
Application Name: MSACCESS.EXE
Application Version: 12.0.6606.1000

[code]...

View 1 Replies View Related

Difficulty Combining Insert Into Or Select Into With A Union, Please Help!

Jan 23, 2007

I am having difficulty getting a query to work, there's probably something really simple I'm missing. . . I can get the Union function to work but I can't get it to create a table for me. The basic query looks like this:

INSERT INTO test
SELECT * FROM [Design] WHERE (Design.CID Not Like "*-*")
UNION
SELECT * FROM [Release] WHERE (Release.CID Not Like "*-*")

It works fine and shows me the table I want without the first line, but I would like it to input into a new or existing table. Any help would be greatly appreciated!

View 1 Replies View Related

Can You INSERT INTO Table With SELECT.. UNION Queries

Mar 29, 2005

I have a UNION of two SELECT queries. It works very well but I need the end-user to be able to modify the data so I am using INSERT INTO tablename. This will work for one query at a time but if I try to use the UNION it reports “Syntax error in FROM clause”. Can you use UNION in this case or can anyone see my error?



The full statement is rather complex, I have added a few spaces and linebreaks to make it readable as follows:

INSERT INTO TableCompleteForMailing

SELECT [Address List].[FamilySurname] AS Surname,

[Address List].[DEARFirstnames] AS FirstName,

[Address List].[Mailing] AS Mailing,

[Address List].[Christmas Mailing] AS OtherMailing, [Address List].[Address 1] AS Address1,

[Address List].[Postcode] AS Postcode

FROM [Address List]

UNION

SELECT [Names].[LastName] AS Surname,

[Names].[FirstName] AS FirstName,

[Names].[MailingList] AS Mailing,

[Names].[Selected] AS OtherMailing,

[Address List].[Address 1] AS Address1,

[Address List].[Postcode] AS Postcode

FROM [Names],[Address List]

WHERE [Names].[AddressListID]=[Address List].[AddressListID]

ORDER BY Surname, FirstName;

View 3 Replies View Related

General :: Monthly Cleaning Program - Crosstab Query To Generate A Report

Jun 12, 2012

I want to create a report for the Monthly cleaning plan of a hotel. For each day, how many rooms need new sheets, how many need new towels etc.

At this point I can generate a report for any given day.

This could be an example of what I want to achieve

Code:
------------ Date | Date+1 | Date+2 | Date+3
New Sheets 2 1 0 2
New Towels 1 3 0 1
Full Clean 0 1 2 0

"Date" is a date tat you can set, after which you'll get the following 30 days("Date+1","Date+2" etc)

I thought that a CrossTab query would give me what I want,but using the wizzard I can't get the result that I want.
Haven't worked with crosstab queries before so maybe I'm doing something wrong, or maybe this isn't even possible with a crosstab query.

View 4 Replies View Related

General :: VBA Select Query With Inserted Value

Feb 13, 2013

With the following VBA code, I'm trying to select the text value from a textbox and fill that in a query to select the code from a person. (a password only login).

However, I'm getting a run time error 3078 at the '' Set rs = db.OpenRecordset("strSQL")'' line.

Code:
Private Sub Tekst6_AfterUpdate()
Dim strSQL As String
Dim strBarcode As String
Set db = CurrentDb()
'strBarcode = Me.Tekst6
'MsgBox strBarcode

[Code] .....

View 8 Replies View Related

Crosstab Query Based On Crosstab??

Sep 21, 2007

Hi all, I am utterly unsure if what I want to do is even possible:

I have two crosstab queries, qryRewCOCredit and qryWrapCOCredit which show the changeover (CO) times for the specified machine when they are NOT zero. (all zero entries don't show up).

There are many cases when there is a CO for the Rewinder on a specific day, but not for the Wrapper, and vice versa.

I want to make another crosstab query which performs a calculation. To keep it simple:

If (RewCOCredit>WrapCOCredit) Then
5-RewCOCredit
Else 'WrapCOCredit>RewCOCredit
5-WrapCOCredit

Please help!!!

View 2 Replies View Related

General :: Select Top 100 In Query Variable Text Box

Nov 6, 2012

i have got a query that returns the top 100 results. i would like to link this to my report form where i have a text box that you can enter a number and the query returns the first of that ammount rather than going into the query everytime to adjust the results.the sql of the query is as follows

PHP Code:

SELECT TOP 100 tblClientDetails.FirstName, tblClientDetails.Surname, Sum(tblOrdersItems.Cost) 
AS SumOfCostFROM (tblClientDetails INNER JOIN tblOrders ON tblClientDetails.ClientDetailsID = tblOrders.ClientDetailsID)
INNER JOIN tblOrdersItems ON tblOrders.OrderID = tblOrdersItems.OrderIDWHERE (((tblOrders.OrderDate)>DateAdd('yyyy',-1,Date())))
GROUP BY tblClientDetails.FirstName, tblClientDetails.SurnameORDER BY Sum(tblOrdersItems.Cost) DESC; 

View 5 Replies View Related

General :: Select Query Producing Inaccurate Results

Mar 6, 2015

I have a query that is returning inaccurate "Date Completed" results. Here is the SQL:

PARAMETERS [Enter Start Date] Text ( 255 ), [Enter End Date] Text ( 255 );
SELECT DISTINCT [Qry BDM FA English Email Test Part 1].ADI_DISTRIBUTOR_ADVISOR, ADL_AAH_ADVISOR_ACTIVITY_HISTORY.AAH_DATE_COMPLETE D, [Qry BDM FA English Email Test Part 1].AGA_EMAIL, ADL_AAH_ADVISOR_ACTIVITY_HISTORY.AAH_EMP_ID, DateAdd("d",180,Date()) AS [Next Update],

[Code] .....

View 4 Replies View Related

General :: Select Non-contiguous Records In Access Table Or Query

May 14, 2013

Is there a way to select non-contiguous records in an Access table or query?

View 3 Replies View Related

General :: Records Using A Select Query That Is Sending To A Make Table

Feb 25, 2015

I have records using a select query that I am sending to a make table. I would like to have those records excluded from being used again for 180 days, at which point they can be used again. Essentially, I have an ID and an email address which gets stored in the Make Table. I would need to ensure that if we send an email out in Week 1, we do not send an email again for another 180 days if there is activity from that same ID. On day 181, the ID/email address can then be resent.

View 6 Replies View Related

General :: Combining Make Table With Union Queries

Aug 13, 2013

Wondering whether it is possible to use the 'Make Table' function in conjunction with a union query. My early attempts have failed and I am relatively new to Access.

I am using Access 2010.

View 2 Replies View Related

General :: Crosstab Average Monthly Demand

Jul 29, 2014

My database has a crosstab query that counts the number of hits by month. I have two columns that are named "Count of Material"(Frequency) and "Sum of ordered Qty"(Total ordered). I need add a colum to find the Average Monthly Demand by dividing the Total ordered/Frequency/number of months in the query. I have tried everything to make it work but can't.

View 8 Replies View Related

UNION Query MS Jet Database Engine Cannot Find The Input Table Or Query.

Oct 28, 2005

Hello All,

I'm trying to run a UNION query that joins five queries through a MS WorkSpace into a DAO.recordset in VB. I'm pulling the data from a SQL Server Database through VB in Access. I'm attempting to open a recordset with a query passed to it as a string. The query is below. For some reason, I'm receiving a message: "MS Jet database engine cannot find the input table or query. Runtime Error 3078".

Here's what's puzzling. When I run a single query without any UNION statement, the code finds the table and runs fine without error, but anytime I join two or more queries with a UNION statement in the VB, it gives me the error.

I've executed the same UNION query in both Access Query Builder and SQL Server's Query Analyzer and they work fine in both environments. It's only when I call the query from a DAO.Recodset with VB that it causes this problem. The following is a sample of the UNION query joining two of the five queries. Does anyone have any idea what could be the problem? The following query executes in about 5 seconds so I don't think there's a "time-out" issue. I'm thinking that the UNION statement may be the culprit. Maybe there's another way to approach joining these separate queries? Any help would be most appreciated. Thanks.

SELECT SalespersonID, Sum([SlsPrice]-[RtnPrice]-[SlsDiscnt]+[RtnDiscnt]) AS fldPrice FROM MyTable WHERE (((Source)='d') AND ((DistrictID)='01') AND ((CategoryID) = 'HCPROD') AND ((BrandID)<>'CSS')) AND (((BrandID)<>'1356')) AND (((BrandID)<>'1400')) AND (((BrandID)<>'1551')) AND (((BrandID)<>'555')) AND (((BrandID)<>'66'))
AND (TransDate >= 07/01/2005) AND (TransDate <= 07/31/2005) GROUP BY SalespersonID
UNION
SELECT SalespersonID, Sum([SlsPrice]-[RtnPrice]-[SlsDiscnt]+[RtnDiscnt]) AS fldPrice FROM MyTable WHERE (((Source)='d') AND ((DistrictID)='01') AND ((ProductID) = '0029800')) AND (TransDate >= 07/01/2005) AND (TransDate <= 07/31/2005) GROUP BY SalespersonID

Set wrkJet = CreateWorkspace("", "pw", "", dbUseJet)
Set db = wrkJet.OpenDatabase("DW", _
dbDriverNoPrompt, True, _
"ODBC;DATABASE=DW;DSN=DW2")
'Set rs1 = db.OpenRecordset(strSQL)

View 9 Replies View Related

SQL Union Query

Aug 18, 2005

I have created a report that provides me with employee expenses for temps per week. The types of expenses have been defined as Ad_hoc amounts.

An SQL union query I have used to combine fields

Adhoc_Code_1 - 3
Adhoc_description_1 - 3
Adhoc_Pay_Amount_1 - 3

(details of full sql query below)

I have tried to run for a particular week which should have 3 expense entries but only 2 have been picked up.

I think this is because both Adhoc_ Pay_Amount_2 and 3 have a value of 6 and the UNION operation will not return duplicate records. I have amended to UNION ALL but all entries are duplicated. Can anyone help?

Thanks

SELECT dbo_Valid_Timesheets.Employer_Ref, dbo_Valid_Timesheets.Personnel_Ref, dbo_Valid_Timesheets.Department, dbo_Valid_Timesheets.Tax_Yr_Proc_By_Payroll, dbo_Valid_Timesheets.Period_Proc_By_Payroll, dbo_Valid_Timesheets.Session_Proc_By_Payroll, dbo_Valid_Timesheets.Adhoc_Code_1, dbo_Valid_Timesheets.Adhoc_Description_1, dbo_Valid_Timesheets.Adhoc_Pay_Amount_1, dbo_Valid_Timesheets.Timesheet_Number
FROM dbo_Valid_Timesheets
WHERE (((dbo_Valid_Timesheets.Adhoc_Pay_Amount_1)<>0));
UNION ALL
SELECT dbo_Valid_Timesheets.Employer_Ref, dbo_Valid_Timesheets.Personnel_Ref, dbo_Valid_Timesheets.Department, dbo_Valid_Timesheets.Tax_Yr_Proc_By_Payroll, dbo_Valid_Timesheets.Period_Proc_By_Payroll, dbo_Valid_Timesheets.Session_Proc_By_Payroll, dbo_Valid_Timesheets.Adhoc_Code_2, dbo_Valid_Timesheets.Adhoc_Description_2, dbo_Valid_Timesheets.Adhoc_Pay_Amount_2, dbo_Valid_Timesheets.Timesheet_Number
FROM dbo_Valid_Timesheets
WHERE (((dbo_Valid_Timesheets.Adhoc_Pay_Amount_2)<>0));
UNION ALL
SELECT dbo_Valid_Timesheets.Employer_Ref, dbo_Valid_Timesheets.Personnel_Ref, dbo_Valid_Timesheets.Department, dbo_Valid_Timesheets.Tax_Yr_Proc_By_Payroll, dbo_Valid_Timesheets.Period_Proc_By_Payroll, dbo_Valid_Timesheets.Session_Proc_By_Payroll, dbo_Valid_Timesheets.Adhoc_Code_3, dbo_Valid_Timesheets.Adhoc_Description_3, dbo_Valid_Timesheets.Adhoc_Pay_Amount_3, dbo_Valid_Timesheets.Timesheet_Number
FROM dbo_Valid_Timesheets
WHERE (((dbo_Valid_Timesheets.Adhoc_Pay_Amount_3)<>0));

UNION ALL SELECT dbo_EE_Payment_History.Employer_Ref, dbo_EE_Payment_History.Personnel_Ref, dbo_Payslip_Static_Data.Department, dbo_EE_Payment_History.Tax_Year, dbo_EE_Payment_History.Tax_Period, dbo_EE_Payment_History.Tax_Session, dbo_EE_Payment_History.Payment_Ref, dbo_EE_Payment_History.Type, Val([Payment_Value]) AS [Value], "" AS Timesheet
FROM dbo_EE_Payment_History INNER JOIN dbo_Payslip_Static_Data ON (dbo_EE_Payment_History.Tax_Session = dbo_Payslip_Static_Data.Session_Number) AND (dbo_EE_Payment_History.Tax_Period = dbo_Payslip_Static_Data.Period_Number) AND (dbo_EE_Payment_History.Tax_Year = dbo_Payslip_Static_Data.Tax_Year) AND (dbo_EE_Payment_History.Personnel_Ref = dbo_Payslip_Static_Data.Personnel_Ref) AND (dbo_EE_Payment_History.Employer_Ref = dbo_Payslip_Static_Data.Employer_Ref)
WHERE (((dbo_EE_Payment_History.Tax_Year)=[Forms]![Misc]![year]) AND ((dbo_EE_Payment_History.Tax_Period)=[Forms]![Misc]![period]) AND ((dbo_EE_Payment_History.Tax_Session)=[Forms]![Misc]![session]) AND ((dbo_EE_Payment_History.Payment_Ref)=777));

UNION ALL SELECT dbo_EE_Payments.Employer_Ref, dbo_EE_Payments.Personnel_Ref, dbo_Payslip_Static_Data.Department, [Forms]![Misc]![year] AS Tax_Year, [Forms]![Misc]![period] AS Tax_Period, [Forms]![Misc]![session] AS Tax_Session, dbo_EE_Payments.Payment_Ref, dbo_EE_Payments.X_Type, Val([Calculated_Value]) AS [Value], "" AS Timesheet
FROM dbo_EE_Payments INNER JOIN dbo_Payslip_Static_Data ON (dbo_EE_Payments.Personnel_Ref = dbo_Payslip_Static_Data.Personnel_Ref) AND (dbo_EE_Payments.Employer_Ref = dbo_Payslip_Static_Data.Employer_Ref)
WHERE (((dbo_EE_Payments.Payment_Ref)=777));

View 10 Replies View Related

UNION ALL Query

May 19, 2005

OK, so I am UNIONing two tables using UNION ALL. It works fine. The resultant table has 192 records (63 + 129).

If a use just UNION or UNION DISTINCT I get 184 records. I'm pretty sure that is telling me that 8 records (192 - 184) exist in both tables.

How do I query to find out what those 8 records are?? I'm trying to use an INTERSECT in MS Access, but it doesn't want to work. Here is my original query:

select * from qryMOE_Active_All
UNION ALL select * from qryMOE_Closed_All;

Thanks,

Brian

View 3 Replies View Related

Union Query

Sep 26, 2005

I am a basic access user so please forgive my ignorance. I have created a union query of three tables. There is one field from the third table that I would like to have in the final table but this field does not exist in the first table. If I put "none" in the first SELECT line, then it queries correctly but the field name on the table is "Expr1006". If I put "Field 2" or [Field 2] in that same space of the first SELECT line, then it asks me for a parameter value and whatever I enter it fills in all the cells of that field with that value. I just don't know that language very well or even if you can add a new field into the first SELECT table. Thank you for any thoughts

Ex: SELECT [Field 1], [Field 2], "none", [Field 3]
FROm [Table 1]
UNION
SELECT [Field 1], "none", [Field 2], [Field 3]
FROM [Table 2]

View 3 Replies View Related

Union All Query Help

Mar 16, 2006

Hello All,
I need help with an Union All Query. It is ignoring the second select statement. Can anyone see what I am doing wrong?

SELECT
CEPM_PLGR.COST_ELEM_CTGY AS [COST_ELEM_CTGY]
, CEPM_PLGR.PROJ_ELEM_ID AS [PROJ_ELEM_ID]
, CEPM_PLGR.COST_ELEM AS [COST_ELEM]
, CEPM_PLGR.SUM_UNIT AS [SUM_UNIT]
, CEPM_PLGR.PRD AS [PRD]
, CEPM_PLGR.CUR_BUD AS [CUR_BUD]
, CEPM_PLGR.PRD_BUD AS [PRD_BUD]
, CEPM_PLGR.CURRENT_ACT AS [CURRENT_ACT]
, CEPM_PLGR.PERIOD_ACT AS [PERIOD_ACT]
, CSIOWNER_PELM.PROJ_ELEM_DESC AS [PROJ_ELEM_DESC]
, CSIOWNER_PELM.PROJ_ELEM_MGR AS [PROJ_ELEM_MGR]
, CSIOWNER_PELM.PROJ_ELEM_TYPE AS [PROJ_ELEM_TYPE]
, NULL AS [COMMIT GA]
, CSIOWNER_PELM.COST_STAT AS [COST_STAT]
, CSIOWNER_PELM.PROJ_NBR AS [PROJ_NBR]
,NULL AS [COMMIT $]
FROM
CEPM_PLGR INNER JOIN CSIOWNER_PELM ON CEPM_PLGR.PROJ_ELEM_ID = CSIOWNER_PELM.PROJ_ELEM_ID
WHERE
((CSIOWNER_PELM.PROJ_TYPE)<>"T&M" And (CSIOWNER_PELM.PROJ_TYPE)<>"T7M") AND ((CSIOWNER_PELM.COST_MODE)="D")
AND ((CEPM_PLGR.PROJ_ELEM_ID)<>" ")
UNION ALL SELECT
NULL AS [COST_ELEM_CTGY]
, NULL AS [PROJ_ELEM_ID]
, NULL AS [COST_ELEM]
, NULL AS [SUM_UNIT]
, NULL AS [PRD]
, NULL AS [CUR_BUD]
, NULL AS [PRD_BUD]
, NULL AS [CURRENT_ACT]
, NULL AS [PERIOD_ACT]
, NULL AS [PROJ_ELEM_DESC]
, NULL AS [PROJ_ELEM_MGR]
, NULL AS [PROJ_ELEM_TYPE]
, (IIf( [PROJECT ID] Like "N0160*" And "N8100*" And "N9004*"
,(NZ([COMMIT $],0))
,(NZ([COMMIT GA $],0)))) AS [COMMIT GA]
, NULL AS [COST_STAT]
, NULL AS [PROJ_NBR]
, [PURCHASE_COMMITMENTS_FINAL].[COMMIT $] AS [COMMIT $]
FROM
[PURCHASE_COMMITMENTS_FINAL]
WHERE [PURCHASE_COMMITMENTS_FINAL].[PROJECT ID]
IN
(SELECT CEPM_PLGR.PROJ_ELEM_ID AS [PROJ_ELEM_ID]
FROM
CEPM_PLGR INNER JOIN CSIOWNER_PELM ON CEPM_PLGR.PROJ_ELEM_ID = CSIOWNER_PELM.PROJ_ELEM_ID
WHERE
((CSIOWNER_PELM.PROJ_TYPE)<>"T&M" And (CSIOWNER_PELM.PROJ_TYPE)<>"T7M") AND ((CSIOWNER_PELM.COST_MODE)="D")
AND ((CEPM_PLGR.PROJ_ELEM_ID)<>" ")) AND (([PURCHASE_COMMITMENTS_FINAL].[PROJECT ID]) <> " ");

I think it is my where clause IN function. But I do not know how to fix it. any help would be great!!!!
Thanks in advanced, Kerrie

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved