Minus <-> Union

Jul 11, 2006

To fill a ddl list I could use a MINUS query. I found out that UNION and UNION ALL work, but MINUS doesn't.

Is there a way to make it work, or maybe an other way to solve this kind of problem?

View Replies


ADVERTISEMENT

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

Plus Or Minus

Mar 21, 2006

Hi,

I am setting up a query to display a records of products within certain sizes.

I want the width to be input, eg; "500" and i want all records - plus or minus 50 of this record to be displayed. I know i could use the "BETWEEN" "AND" command but i want the user to only enter 1 size if it is possible.

Any help greatly apreciated.

Thanks

Don

View 1 Replies View Related

Minus Figure

May 20, 2005

Hi
This is probaly really easy, I want to identify just minus figues in a query ie -5.00. I have tried iif([TotalPrice])<0,[TotalPrice]) this shows no result. Can any one advise. Thanks in advance.

View 1 Replies View Related

MINUS Operator

Nov 15, 2005

Hi guys!

It's unknown for me why Access hasn't got MINUS implemented and Unmatched Query Wizard doesn't help me much. So I'm wondered if anyone had to confront the following task:

Table1

Book Agent
----------
b1 a1
b2 a2
b3 a3

Table2

Book Agent
----------
b1 a1
b3 a3

The problem is I have to eliminate duplicates but I need to find unique row, which is Book and Agent. From my example it's row with (b2 a2). I tried using
Select * From Table1
Where (Book, Agent) Not In (Select Book, Agent From Table2)
didn't work
I also tried EXISTS
didn't work
Unmatched Wizard compares only one field, not two.

Any comments welcome, thank you

View 2 Replies View Related

Get A Minus Number Where It Should Me A 0

Mar 15, 2005

Hi,
I've searched this forum and can't quite get what I need.
I have a subform on a form, in the footer of the subform I total an amount owing field. Then I get the value from the footer control to the main form. I know that the total should be 0 but on the main form I get a -0.0119. How can I get this to show 0.
Thanks

View 1 Replies View Related

I Want To Do A MINUS Operation Equivalent. How?

Jan 16, 2007

this is vexing me.

I have 4 tables, 2 entities, 1 relationship and 1 lookup

Entities are tblOrg and tblForm
Relationship is tblVentureParticipation
Lookup is tblInfo (Has many different lookups)

When an organization (these are listed in tblOrg) turns in a form, a new record is inserted into tblForm with the ID of that organization and the ID of the form

I want to identify the forms that have NOT been turned in.

So I figured

Step 1:
Identify all organizations who are participating (WHERE tblOrg.OrgID = tblVentureParticipation.OrgID)

Step 2:
Join all of the previously selected organizations with all of the forms (FROM tblOrg, tblInfo WHERE tblInfo.LookupID LIKE 'F##')

Step 3:
Remove all of the entries in tblForm that match the result of Step 2.

I have verified that both of these individual queries return the right information ...

View 1 Replies View Related

'Sum' Ignoring Minus Figures

Jan 22, 2007

I've been using the following query:

SELECT
[qry_1].Month,
B_Division_Group.Grouping_Name,
Sum([qry_1].Month_Client_Count_from_B) AS Monthly_Count,
Sum([qry_1].Month_Assets_from_B) AS Monthly_Total,
Sum([qry_1].YTD_Client_Count_from_B) AS Yearly_Count,
Sum([qry_1].YTD_Assets_from_B) AS Yearly_Total
FROM
([qry_1] INNER JOIN tbl_branch
ON [qry_1].BranchCode = tbl_branch.BranchID)
INNER JOIN B_Division_Group
ON tbl_branch.BranchName = BDivision_Group.N_Br
GROUP BY
[qry_1].Month,
B_Division_Group.Grouping_Name;

While all monthly and yearly values were positive, the query produced exactly the results expected (i.e. one row of data for each Grouping Name/Month combination, containing the overall totals for each field).

Now, however, some Grouping Names have minus values and the query is showing an extra row (one for positive values, one for negative). It's as if having one or more minus values is being treated as a new Grouping Name/Month combination.

Is Sum() the correct method to use, when dealing with negative values, or should I be using some other function?

View 3 Replies View Related

Date Minus 1 Year

Jul 25, 2007

I am creating a report and I need data about parts that have not been used in the past 12 months. I'm not sure how to get just numbers from the past 12 months. How do I get the current date minus 1 year?

View 2 Replies View Related

TimeOut Minus TimeIn

Dec 13, 2006

I have a datasheet subform that is acting like a timesheet. I have a TimeIn field and TimeOut field (both fields formatted as Medium Time); and a field for Hours to total the time. I used the expression =HoursAndMinutes([TimeOut]-[TimeIn]) that I found in another post, and it didn't work. All I got was #Name. Any thoughts as to why that's happening? I would preferably like the hours to total in tenths of hours, ie. 10.5.

Thanks
ScrmingWhisprs

View 6 Replies View Related

Default Value And Expression Minus 1 Day

Mar 4, 2015

So I am trying to setup a default value in the tbl design. The Following two fields are the two in question(StartDate & ReportDate). It already has relevant dates properly formatted in the StartDate Field. The ReportDate will always be the day before or minus 1 day from the Startdate. My question is that I can't seem to get the syntax right to make it work.

Screenshot included.

View 1 Replies View Related

Sum IF Else Minus - Calculation In Field

Mar 4, 2013

I have a report which is a statement. I want to be able to have a field that calculates rent, and minus payments. There are a few rent types, Pro Rated rent, Rent brought forward and rent changed, then there is 1 payment type. I am trying to write the sum a few ways, but have not had success. If rent type i= 1 or 2 or 3 I want it to add, if rent total = 4 I want it to minus.

=Sum(IIf([RentType]=1 Or 2 Or 3,[RentAmount],0))-Sum(IIf([RentType]=4,[RentAmount]))

View 2 Replies View Related

Queries :: Sum Field Then Minus Quantity

Jun 3, 2014

I am trying to sum a qty field naming it 'TotalRecieve' and then minus a qty from that sum?

I've tried the following

Code : RemainingQty: Sum([tblReceiveDetail].[QTY])-[tblOrderDetail].[Qty]

but i get an error saying 'Your query does not include the specified expression as part of an aggregate function?

View 2 Replies View Related

General :: Minus One Amount From Another In Subform

Apr 1, 2014

I need to minus one amount from another in my subform.

How to do that and which command to use? Sum?

Also should I go to criteria and do it there?

View 2 Replies View Related

Queries :: Using One Date Minus To Other Dates

Jul 8, 2015

I need to create a query that will do the next:

use today's date, minus start date, minus sent to BP, minus response from BP.

The field names are:
Start_Date
Sent_to_BP
Response_from_BP

I also have a holiday table that should be used to have only business days passed (so, not weekends and holidays counting).

View 8 Replies View Related

Forms :: Plus / Minus Button For Any Numeric Box On Form

Oct 1, 2014

I'm working on a form that I want to insert a plus button/minus button.I am aware of the vba code numbers 107 and 109 if you want to use the actual keys but I would rather use a button.

I made a button and here is the code I used now. This code is numeric box specific. So it only adds one to the MileageStart numeric field. (Additionally you can put a minus in to subtract one).

Private Sub Command153_Click()
MileageStart = MileageStart + 1
End Sub

Instead of having a bunch of these buttons all over boxes on my form is there some code that I can use to "select" a text box and just have the Plus/Minus button on the form header that I would hit and it would add or subtract (and then I could go to another box select it and hit Plus/Minus and so forth).

View 7 Replies View Related

Forms :: Continuous Form Plus / Minus Button

Dec 17, 2013

I am trying to make a simple form to tally my total products ordered.

So I wanna add a plus and minus button on my continguous form, but i cant get it to work. How do i update the current record when clicking on the button next to the field ..? It seems only the first record gets updated ..

View 1 Replies View Related

Queries :: Pull Between Today's Date Minus A Week?

Feb 21, 2014

I am trying to pull between the current date minus a week in my Access query and I do not know what formula to use.

View 8 Replies View Related

Forms :: Minus Value Conditional Formatting - Color Background

Feb 5, 2014

I would like to have a Positive value with a green Background and a Negative Value with a Pink Background.

View 3 Replies View Related

Forms :: Conditional Color Formatting For Plus And Minus Number

Apr 18, 2014

how to have a different conditional colour formatting for a plus and a minus number

If the field value is a Plus Number
The background colour will be Green

If the field value is a Negative Number
The background colour will be Pink

View 6 Replies View Related

Get Date (minus One Day) Excluding Weekends And Holidays In SQL Query To Use In Access

Oct 11, 2012

I am trying to limit the results of a SQL query by date. I would like to take the current date from the system clock, move back one day, check to make sure it's not a weekend or holiday, then use the result date to limit the results in my Query. If the current date minus one day happens to land on a weekend, the date picked should be the Friday before the weekend. If the current date minus one day lands on a holiday, it should be the date before the holiday as long as it is not a Saturday or Sunday (on another holiday) .

Here is my SQL query right now.

SELECT DISTINCT (Mid(ClientDiv.Client_Division,1,3)) AS ABC, RTIClientTracker.EMB_OOB, RTIClientTracker.OOB_Fixed
FROM ClientDiv INNER JOIN RTIClientTracker ON ClientDiv.ID = RTIClientTracker.Client_Division
WHERE (((RTIClientTracker.Division_Region)='RTI') AND ((RTIClientTracker.Cut)>=Date()-1))
ORDER BY (Mid(ClientDiv.Client_Division,1,3));

It limits what it selects by using the current Date minus one day.

I need to skip over Saturdays, Sundays and Holidays.

View 8 Replies View Related

REPORT Figure To Show In Red "if" A Minus

Dec 8, 2004

Is it possible to show a number in red only if that number is a minus?

View 2 Replies View Related

Sum Of Current Year Minus The Year Of A Date In Past?

Apr 25, 2014

I'm trying to add a couple of fields to the Contact database in Access 2010.

In the Contacts table, I created a field called "Sobriety Date" that has dates formatted like 12/27/1995

I am trying to add a calculated field called "Years Sober" which should be the current year minus the year in the 'Sobriety Date' field (1995 in the example above).

I have been trying to tweak this:

SUM(DatePart("yyyy",[Date]) - DatePart("yyyy",[Sobriety Date]))

but it's not working. Keeps giving me "The expression that you entered is not valid for web-compatible calculated columns"

View 2 Replies View Related

Union All

Mar 31, 2008

Hi,

Can anyone please tell me what I am doing wrong here?

SELECT *
from Qry_300_Sel_In Jan not Dec

UNION ALL

SELECT *
from Qry_301_Sel_In Apr not Dec

UNION ALL

SELECT *
from Qry_302_Sel_In Jul not Dec

UNION ALL SELECT *
Qry_303_Sel_In Oct not Dec;

It is telling me that my syntax is wron in the From clause - But I don't get it!

View 3 Replies View Related

Union Qry

Nov 17, 2006

Hello again.

If anyone can help me it would be greatly appreciated.
I知 not sure shy I知 having so much trouble with this, but I知 sure that this will be a great learning opportunity for me.

I値l explain it two different ways, and that way hopefully it will make sense

First off I知 trying to take all the Companies I work with and get there Net Sales

Example:
Company 1 $1,625.25
Company 2 $6,782.12
ect

I have two queries

The first one is:
qrtySym_Global_ALL_and_SUBFILE_A3

The second one is:
FROM qrtySym_Global_ALL_and_SUBFILE_A4

Below is the Union Query I currently have, and it puts together both queries and shows the totals separately

I would like it to show the Company Name and next to that the Net Sales for that company


SELECT "Total" , Sum(NETSALES)
FROM qrtySym_Global_ALL_and_SUBFILE_A3
union All
SELECT "Total" , Sum(NETSALES)
FROM qrtySym_Global_ALL_and_SUBFILE_A4


Let me see if I can explain it better

The are three columns in the two queries that are the same.

Company Business/ Company Name/Net Sales

I知 trying to take all the

A: Company Business that has the same name from query 1 and query 2 and merge them.

B: Company Name that has the same name from query 1 and query 2 and merge them.

C: Then with the merging of Company Business and the Company Name, Sum the total for the Net Sales.

I really appreciate you helping, so let me know if this doesn稚 make sense

Thanks

Corey

View 1 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







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