Excluding Records From A Qry

Feb 28, 2006

Hi All,

I'm trying to extract records that start with 10 but I need to exclude all that start with 1011,1015 & 1025

so far I can only extract records that I need but cant exlude the others when I use the SQL below

INSERT INTO tblConceptOrders ( TA_TASK_ID )
SELECT dbo_F_TASKS.TA_TASK_ID
FROM dbo_F_TASKS
GROUP BY dbo_F_TASKS.TA_TASK_ID
HAVING (((dbo_F_TASKS.TA_TASK_ID) Like "10*"))
ORDER BY dbo_F_TASKS.TA_TASK_ID;


I'm looking for a better way to exclude the records I don't want & collect the ones that I do

Any help will be appreciated

thanks :)

View Replies


ADVERTISEMENT

Need Help Excluding Records

Feb 13, 2008

Good morning,
I'm trying to create a query and I'm asking for specific records, but also need to exclude certain records within that criteria. Here is my Select statement:

SELECT [MD IMPORT PURGE PEND].PROC,
[MD IMPORT PURGE PEND].SEG,
[MD IMPORT PURGE PEND].NAME,
[MD IMPORT PURGE PEND].GROUP,
[MD IMPORT PURGE PEND].BEN,
[MD IMPORT PURGE PEND].DATE,
[MD IMPORT PURGE PEND].RISK,
[MD IMPORT PURGE PEND].REASON,
[MD IMPORT PURGE PEND].PLAN,
[MD IMPORT PURGE PEND].PAR,
[MD IMPORT PURGE PEND].IND,
[MD IMPORT PURGE PEND].REC,
[MD IMPORT PURGE PEND].SUBNO,
[MD IMPORT PURGE PEND].CLIENT,
[MD IMPORT PURGE PEND].CLAIM,
[MD IMPORT PURGE PEND].FSDT,
[MD IMPORT PURGE PEND].PDDT,
[MD IMPORT PURGE PEND].CHECK,
[MD IMPORT PURGE PEND].PROV,
[MD IMPORT PURGE PEND].SOURCE,
[MD IMPORT PURGE PEND].PAYEE,
[MD IMPORT PURGE PEND].EFF2,
[MD IMPORT PURGE PEND].CSHRCNO,
([CARR] & [CARR1] & [CARR2]) AS CPL,
[MD IMPORT PURGE PEND].CLASS,
[MD IMPORT PURGE PEND].MKTSEG,
[MD IMPORT PURGE PEND].PAID
FROM [MD IMPORT PURGE PEND]

WHERE ((([MD IMPORT PURGE PEND].SEG)="CONTROL") AND
(([MD IMPORT PURGE PEND].REASON)="44" Or ([MD IMPORT PURGE PEND].REASON)="51") AND
(([MD IMPORT PURGE PEND].IND)="HOMES" Or ([MD IMPORT PURGE PEND].IND)="OTHER") AND
(([MD IMPORT PURGE PEND].SOURCE)<>"IN" And ([MD IMPORT PURGE PEND].SOURCE)<>"IP") AND
(([MD IMPORT PURGE PEND].PAYEE)="J" Or ([MD IMPORT PURGE PEND].PAYEE)="N")) OR

((([MD IMPORT PURGE PEND].SEG)="CONTROL") AND
(([MD IMPORT PURGE PEND].REASON)="44" Or ([MD IMPORT PURGE PEND].REASON)="51") AND
(([MD IMPORT PURGE PEND].IND)="HOMES" Or ([MD IMPORT PURGE PEND].IND)="OTHER") AND
(([MD IMPORT PURGE PEND].PAYEE)="S" Or ([MD IMPORT PURGE PEND].PAYEE)="M")) OR

((([MD IMPORT PURGE PEND].SEG)="CONTROL") AND
(([MD IMPORT PURGE PEND].REASON)="35") AND
(([MD IMPORT PURGE PEND].IND)="HOMES" Or ([MD IMPORT PURGE PEND].IND)="OTHER") AND
(([MD IMPORT PURGE PEND].EFF2)="3")) OR

((([MD IMPORT PURGE PEND].SEG)="NASCO-NASCO") AND
(([MD IMPORT PURGE PEND].REASON)="44" Or ([MD IMPORT PURGE PEND].REASON)="51") AND
(([MD IMPORT PURGE PEND].IND)="HOSTP" Or ([MD IMPORT PURGE PEND].IND)="OTHER") AND
(([MD IMPORT PURGE PEND].SOURCE)<>"IN" And ([MD IMPORT PURGE PEND].SOURCE)<>"IP") AND
(([MD IMPORT PURGE PEND].PAYEE)="J" Or ([MD IMPORT PURGE PEND].PAYEE)="N")) OR

((([MD IMPORT PURGE PEND].SEG)="NASCO-NASCO") AND
(([MD IMPORT PURGE PEND].REASON)="44" Or ([MD IMPORT PURGE PEND].REASON)="51") AND
(([MD IMPORT PURGE PEND].IND)="HOSTP" Or ([MD IMPORT PURGE PEND].IND)="OTHER") AND
(([MD IMPORT PURGE PEND].PAYEE)="S" Or ([MD IMPORT PURGE PEND].PAYEE)="M")) OR

((([MD IMPORT PURGE PEND].SEG)="NASCO-NASCO") AND
(([MD IMPORT PURGE PEND].REASON)="35") AND
(([MD IMPORT PURGE PEND].IND)="HOSTP" Or ([MD IMPORT PURGE PEND].IND)="OTHER") AND
(([MD IMPORT PURGE PEND].EFF2)="3")) OR

((([MD IMPORT PURGE PEND].SEG)="PAR") AND
(([MD IMPORT PURGE PEND].REASON)="44" Or ([MD IMPORT PURGE PEND].REASON)="51") AND
(([MD IMPORT PURGE PEND].IND)<>"HOSTS") AND
(([MD IMPORT PURGE PEND].SOURCE)<>"IN" And ([MD IMPORT PURGE PEND].SOURCE)<>"IP") AND
(([MD IMPORT PURGE PEND].PAYEE)="J" Or ([MD IMPORT PURGE PEND].PAYEE)="N")) OR

((([MD IMPORT PURGE PEND].SEG)="PAR") AND
(([MD IMPORT PURGE PEND].REASON)="44" Or ([MD IMPORT PURGE PEND].REASON)="51") AND
(([MD IMPORT PURGE PEND].IND)<>"HOSTS") AND
(([MD IMPORT PURGE PEND].PAYEE)="S" Or ([MD IMPORT PURGE PEND].PAYEE)="M")) OR

((([MD IMPORT PURGE PEND].SEG)="PAR") AND
(([MD IMPORT PURGE PEND].REASON)="35") AND
(([MD IMPORT PURGE PEND].IND)<>"HOSTS") AND
(([MD IMPORT PURGE PEND].EFF2)="3")) OR

((([MD IMPORT PURGE PEND].REASON)<>"35" And ([MD IMPORT PURGE PEND].REASON)<>"44" And ([MD IMPORT PURGE PEND].REASON)<>"51") AND
(([MD IMPORT PURGE PEND].IND)="HOMES") AND
(([MD IMPORT PURGE PEND].CHECK)="000000000") AND
(([MD IMPORT PURGE PEND].PAYEE)="S" Or ([MD IMPORT PURGE PEND].PAYEE)="M") AND
(([MD IMPORT PURGE PEND].EFF2)="3") AND
(([MD IMPORT PURGE PEND].CSHRCNO) Is Null));

The part in bold is the exclusion. I want it to exclude records where the reason is 35 or 44 or 51, IND is HOMES, check number is 000000000, payee is s or m, eff2 is 3 AND cshrcno is null.

Can anyone tell me how to achieve this? I really appreciate your help!

View 4 Replies View Related

Excluding Records If They Appear On Another Table?

Sep 27, 2005

Hello, I'm new to the forum and relatively new to Access. There's something I'm trying to do but I'm not sure if it's even possible so I'm hoping someone can help me out and point me in the right direction

the situation:

I have one very big table containing data for around 250 petrol stations. The data is collected monthly, so each site has a record relating to each month. E.g site A has data for month 1, 2, 3 etc.

The problem is that in any month, some of this data needs to be excluded from analysis. And this will vary over the months. What I want to do is run a query where specific records are excluded, for example, exclude Site A data for month 1 and 3, Site B data for month 2 etc.

I have another table containing a list of which site + month data is bad and to be excluded. Ideally I want to simply add to the list each month before I run the select query.

the question:

Is there any way to exclude records from a select query based on their details appearing on another table?

help would be much appreciated!
thanks
Catherine

View 2 Replies View Related

Excluding Records From Separate Table

Apr 29, 2006

I created a report where is lists sales volume by day. I was asked to create a table where data can be excluded from this report. The exclusion table consists of only three fields:

Date Department and a check box

What do I need to do in the query to have it exclude the data listed in this exclusion table. The table only holds data we want excluded, not all dates and departments.

I originally added the table to the source query and made the criteria "False" for the check box but when the query runs it does return any data at all.

Please help!

View 1 Replies View Related

Excluding Records Based On A Number Of Criteria

Sep 20, 2005

Hello all,

I'm having some difficulty obtaining the answers I want from my query. I'd have been more comfortable using filters in excel to find the answers, but my dataset is too large in this instance.

I devised a query which I thought should achieve the results, but based on a subset analysed in Excel the answers are significantly different.

My table has about thirty fields, the query I've produced is this:
SELECT AH_orphans.Product, AH_orphans.Comments, AH_orphans.ESP, AH_orphans.[ESP Parts],
<snip, all other fields in table>
FROM AH_orphans
WHERE (((AH_orphans.ESP)="n") AND ((AH_orphans.FRU)="y") AND ((AH_orphans.EntitlementName) Like "*uptime*") AND ((AH_orphans.Account) Like "nation*") AND ((AH_orphans.Type) Like "Primar*") AND ((AH_orphans.[Is a parent?])="#n/a")) OR (((AH_orphans.ESP) Is Null) AND ((AH_orphans.FRU) Is Null) AND ((AH_orphans.EntitlementName) Like "*uptime*") AND ((AH_orphans.Account) Like "nation*") AND ((AH_orphans.Type) Like "Primar*") AND ((AH_orphans.[Is a parent?])="#n/a"));

What I'm hoping for is the subset which match the following conditions:
- ESP field is not "Y". Possible values Y, N, null
- FRU field is not "N". Possible values Y, N, null
- Only those records from EntitlementName which include the substring 'uptime'
- Only those records from Account which start with the subtring nation
- Only those records from Type which include the substring primar
- Only those records from [Is a parent?] which equal #N/A.

Asking the same questions in Excel I get around 1.5k records. If I use the quoted query on the same dataset in Access I get precisely 11.

Thanks for reading this far! If anyone can spot the flaw/s in my query, or indeed advise that I'm going at it completely the wrong way I'd be very grateful of some advice.

Cheers,
Alex

View 4 Replies View Related

Excluding Deleted Records From An Imported Table

Jun 6, 2007

Hi

I have a table that I am importing from FOXPRO DATABASE. When someone goes into the system and deletes a record, Foxpro does not really delete the records but marks it for deletion. There is no field to query on that I can see in the table, but when I go to Foxpro the record is "marked" for deletion.

Anyway to exclude these records when doing a query or importing the table?

Thanks

View 1 Replies View Related

Excluding A Single Specific Record Among Many Records

Sep 13, 2007

Hello Query Expert

Hi I would like to exclude two specific records from my recordset.

For example suppose I have a Flights Database and I want to see all the flight records for Aircrafts 132 and 232 only, between the date jan 1, 2007 to Sep 12, 2007.

The above I know how to do achieve...

([FltNum] = 132 or [FltNum] 232) AND ([FltDate] >= Jan 1, 2007 and [FltDate] <= Sep 12, 2007)

However, among this set of records I want to exclude flight 132 on Aug 1, 2007 and flight 232 on Sept 1, 2007.

([FltNum] = 132 or [FltNum] 232) AND ([FltDate] >= Jan 1, 2007 AND [FltDate] <= Sep 12, 2007) AND NOT ([FltNum]=132 AND [FltDate] = Aug 1, 2007 ) AND NOT ([FltNum]=232 AND [FltDate] = Sep 1, 2007)


I haven't been able to accomplish this using the query grid. Is it possible or do I have to write SQL?

How would you write this in SQL?

Thanks so much.

View 4 Replies View Related

Queries :: Excluding Records - ISNULL Criteria

May 3, 2013

All using access 2010. I have a query1, query2 and query3. Query1 is my master. Query2 and Query3 was created based on different criteria but derived from the Query1. I now want to exclude the records from Query1 that are in Query2 and Query3. When I try to put isnull in criteria of both queries Im trying to exclude; instead of returning the remainder records in the master I get none.

View 3 Replies View Related

Queries :: Excluding Records - Keeping Nulls

May 2, 2013

I have a table of around 6000 records comprising 4 fields (A,B,C,D).

- Each field can contain numbers or Nulls.
- Each record can comprise all numbers, a mixture of numbers or Nulls, or all Nulls.

I'd like to build a query that excludes all records that contain any number from a small list of numbers.

This sounds very simple but I am having problems when trying to include records that have Null's in my query output.

For test purposes I tried to exclude all records that contain the numbers 1 or 9 (these numbers can be present in any field).

This works perfectly, in isolation, on Field A (i.e. 1 or 9 but not Null are excluded from field A):

Code:
WHERE Table.A Not In (1,9) OR Table1.A Is Null;

When I try to copy the above, referencing fields B-D, I run into problems - no matter how I try to alter the Boolean operators.

View 2 Replies View Related

Forms :: Query Excluding Specific Records?

Jan 16, 2015

Trying to build a CRM system for the office but am getting stuck with the below...

Each company (tblCompany) in the database has at least 1 enquiry (tblEnquiries) linked to it and normally at least 1 (sometimes 0) people (tblPeople).

I have a form which loads company specific information e.g. notes/quotes/orders/people/enquiries. All data is loaded based on the company unique id (c_id).

The attached image shows Company 1 (c_id = 1). It has 6 enquiries. However the subform only displays 5 of these. It does not display any which do not have a person (or p_id) linked to it - this is consistent throughout the database. I have included the table relationships and the enquiry as well in case they are needed!

Searching the net seems to suggest 2 possibilities:

1 - the relationship join type needs to be set to include all from tblEnquiries and only those from tblPeople where joined fields are equal, however changing the join properties does not appear to have an effect.
2 - table field types do not match (all _ID fields are set to number, unique numbers only).

[edit]: am using Access 2010!

I have re-designed the query to pull through tblEnquiries and tblPeople data based on the c_id field on the open form, which is now showing all records, including those not assigned to a person.

However, in the form I can select one from the query datasheet and open to see additional info. Those without a blank p_id number do not open, I receive the error:

"Run-time error '2113': The value you entered isn't valid for this field.

All _id fields are set to numeric so am not sure how to correct this?

View 2 Replies View Related

Excluding Multiple Records From Query Based On Value In ONE Record

Sep 27, 2005

Table1 gives Case Nu.

Table2 gives Case Nu. and EventType.

Table3 gives EventType and Cleared (yes/no field)

I want to run a query that gives Case Nu and Event where if there is even one event marked Cleared for a Case, then that case number and its events (even those not marked cleared) don't show up at all.

Any ideas? I know there must be an obvious solution, but my mind is stuck right now!

View 2 Replies View Related

Queries :: Query Criteria Excluding Table Records

Jul 23, 2015

I want to run a query on a table that holds all speed information for our trucks imported from a third party. Some of the speed alerts in that table are not correct so we set up a second table managed by the users to enter a speed exception. So if we know that Main St in Dallas TX generates false alerts for speeding we know not to call the driver, the third party db speed limit is not up to date.

So I want my query to pull all the speed data from tblSpeedData, except leave out the records where the street and zip are listed in the tblSpeedExceptions.

View 3 Replies View Related

Queries :: Check All Records Excluding 10 Newest In Table

Sep 12, 2014

I am trying to write a query that will check all records in a table but exclude the 10 newest records in the table.

The table is from a stock program i have wrote for the company i work for (i am a novice access user). what ive been asked to do is write a duplicate order system that will flag up if the order has already been packed.

the table logs the [OrderID] with each item [barcode] scanned out with a barcode scanner what i want is a query that checks the OrderID for a duplicate entry in the entire table but because the OrderID is entered with every item scanned i want to ommit the last 10 records as prety much no order has more than 10 items i understand this may not be 100% fool proof but it is close enough.

The other option is to have it ommit all records within the last 15 minutes there is also a [Time] and [PackDate] Field which im guessing could be used for this the time field records Now() and the PackDate records Date(). After searching the web i cant seem to find anyway to ommit the last 'n' records and the few things i have found with the Date("m",-15,Date()) doesnt seem to work

View 7 Replies View Related

Queries :: Excluding Records From Search Results That Have Fields With No Data?

Aug 6, 2015

I have a search form with 12 fields. In my query I use

Code:

Like "*" & [Forms]![CustomerRetestDatabaseSearch]![RetestLocation] & "*" Or Is Null

for each field on the search form.

I get the results I expect, it finds all records that match the criteria. Even if some of the fields in a record are null.

But if the query finds a record that matches one field I enter criteria into, and nulls for the other fields I enter criteria into it displays the record. I want to show exact matches. (If what I entered is null... don't show the record).

The reason I have "Or Is Null" is to include the records for the fields I left blank on the form.

Search Form with Criteria.PNG

Search Query.jpg

Search Results With Missing Entered Criteria(Dont Want These Records Included).jpg

View 2 Replies View Related

Modules & VBA :: Unable To Get All Records By Excluding Numrows Argument In Getrows Method?

Jul 31, 2014

Why I am not able to get all records by excluding the Numrows argument in the getrows method?

Sub Test2()
Dim myrset As Recordset
Set myrset = CurrentDb.OpenRecordset("SELECT * FROM Holidays;")
myrset.MoveLast
myrset.MoveFirst
MsgBox Excel.Application.WorksheetFunction.Networkdays(#8/1/2014#, #8/31/2014#, myrset.GetRows(myrset.RecordCount))
MsgBox Excel.Application.WorksheetFunction.Networkdays(#8/1/2014#, #8/31/2014#, myrset.GetRows())
End Sub

Second MessageBox is giving a wrong value.

Is it a mandatory one? Or Do I have to do some ritual like (Movelast) before that?

(Holidays table is just having the values in the array only ie. #08/15/2014# and #08/29/2014#)

View 10 Replies View Related

Excluding Data From A Query

Jul 30, 2006

Could someone please help me? I am trying to run a query in which I would like to exclude a particular person's name from the query. For example, I am entering productivity information for each employee and manager each day, however, I only want the employee information to appear in the reports each day. Is there anyway of excluding a name from a query?

Thanks:)

View 2 Replies View Related

Total Excluding Duplicate

Nov 14, 2007

Dear Friends,

I have one query based on code, rate, quantity. I created field for total (rate x quantity). What expression i can write that the query will calculate total only with the first figure as per code and if code repeats again, should not calculation total.

Please see the following query structure. Thats how i want my total to be calculated.

Code, Rate, Quantity, total
50,100,10,1000
50,100,10
60,200,20,4000
60,200,20
60,200,20
70,200,30,6000

Thanks
mithan

View 7 Replies View Related

Excluding An Entire Table?

Oct 9, 2006

I have one table that will consists of about 1,000 rows. I have another table that consists of product codes that we want to exclude from the report. I know how to include the two tables by joining, but I want to EXCLUDE the 2nd table of product codes. Basically, if any of the product codes listed on table 2 are on table 1, I don't want them to appear. So how can I do an exclude function in a query?

View 3 Replies View Related

Help Excluding Duplicate Values

Feb 14, 2008

Is there a way that in a query from several tables you can choose to exclude duplicates of a specific field?

In the query I'm trying to create I am going through and counting the number of customers in a certain time frame. I don't want to count a customer each time they buy something though, I only want to count them once. The dates of their purchases are held in a seperate table for purchases and the customer information is held in a customer table. The information I need is in both of these tables and each customer has an ID number which is how the two tables are joined.

When I tried using the DISTINCT code it still brought in all the purchases because the customer bought things on different dates. The only way I have ever used this, however, is to write SELECT DISTINCT at the beginning of the SQL instead of just SELECT. If there's another way to use it to do what I need I will try it as long as you tell me what it is.

How can I set up the query to bring in all the information I need but not duplicate the ID numbers?

Thanks in advance for any help I get!!!

View 3 Replies View Related

Excluding A Field From The Second Table In A Join

Jul 1, 2005

Hello,

I have 2 tables.

1) Table A, which is a table of all 100,000 users
2) Table B, which is a table of all other users

I have a query qryA, which looks for everyone in table A with a certain type of job title.

I want to exclude anyone who works for a company that occurs in the table B from showing up in the qryA query.

Any ideas?

View 2 Replies View Related

Excluding Dates Problem - Syntax

Nov 9, 2005

Hi all,

I have a table with some records:

Name, Date (Day/Month/Year)
John, 09/09/2005
Phil, 10/09/2005
Xena, 03/11/2004

I want my query to display all records with today's date, or those that are 100 days older than today's date.

I have the following so far (in my query criteria box):
Date() Or <Date()-100

BUT this shows me Xena's record, which is more than 100 days old (it's 2004)

Any help/corrections are welcome

Thanks

View 5 Replies View Related

Excluding A Field Which Exists In Another Table

Mar 10, 2006

Hi All,

Say you've got 2 tables and you want to extract data from table 1 but exclude all records from table 1 which have a field value existing in table 2?

Table 1 fields:
Test_Code
Test_Desc

Table 2 fields:
Test_Code

Therefore, I would like to query out from Table 1 all Test_Code values which do not exist in Table 2. Any ideas please?

View 2 Replies View Related

Excluding Boolean Values From A Query

Mar 26, 2006

I have designed an invoice for a project that shows the amount of money needed to be paid, some of this has already been paid and some hasnt, how am i able to make it so that the values that have been paid and therefore have been checked are not include in the query. please help.

View 1 Replies View Related

Excluding Zero Values In A Crosstab Queries

Jun 8, 2006

Hi all, I know this is a real easy one, but I am not the smartest when it comes to access. Can you help me out.

I am running a crosstab query to count and sum records in my database. I have a fied called "Amount". In my form the user is not always required to enter an amount. When I run the query, I would like the results to exclude the records that have a null value or $0.00 in the "Amount" field.

How do I format the query to exclude those records?

Thanks in advance.

View 3 Replies View Related

Query Is Excluding Needed Information

Mar 1, 2007

I have created a query showing locations of a company's facilities, and product groups associated with that facility. Unfortunately the the products groups are located in one column and, if the facility produces more than one product, the product group is divided by a |, as shown below:
CABLE TRAY SECTION [05CT]|STEEL CONDUIT AND ELECTRICAL METALLIC TUBING SECTION [05RN]
In my query, I only want to show the product code, which I resolved by creating another table and associating the code with the product group. However, this query will exclude those plants that produce multiple products. How can I show just the product codes for all the facilities, including those with multiple product groups?

In otherwords, I would like the above example to look like this: 05CT|05RN (or something similar to this).

View 4 Replies View Related

Setting Dates Excluding Weekends.

Jan 10, 2008

Hello all,

I am a bit stuck in my query. I need to setup a Next Follow-up date based on the last follow-up date excluding weekends.

For example: Last Follow-up: 1/10/08.

Next follow-up should be 5 days after that. So it should be: 01/17/08.

I have a calculated field that calculates the number of days (Counting off weekends) but I can't seem to have the date setup correctly.

Thanks

View 7 Replies View Related







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