Hello All,
Thank you for your thoughtful consideration.
I am running Access 2000 (9.0.3821 SR-1)
This query works: - SELECT [id], [name]
-
FROM table1
-
WHERE id NOT IN (SELECT document_type_id FROM table2 WHERE case_type_id=case_type_id ) AND id NOT IN (SELECT document_type_id FROM table3 WHERE case_number='case_number')
-
ORDER BY name;
Against these tables: - table1
-
id AutoNumber (Primary Key)
-
name Text
-
description Text
-
date_create Date/Time (General Date)
-
date_update Date/Time (General Date)
- table2
-
id AutoNumber (Primary Key)
-
case_type_id Number (Long Integer)
-
document_type_id Number (Long Integer)
-
date_create Date/Time (General Date)
-
date_update Date/Time (General Date)
- table3
-
id AutoNumber (Primary Key)
-
case_number Text
-
delay_type_id Number (Long Integer)
-
document_type_id Number (Long Integer)
-
other_document_type Id Number (Long Integer)
-
event_open_date Date/Time (Short Date)
-
event_close_date Date/Time (Short Date)
-
date_create Date/Time (General Date)
-
date_update Date/Time (General Date)
But this query returns nothing: - SELECT [id], [name]
-
FROM table4
-
WHERE case_number='case_number' AND id NOT IN (SELECT other_document_type_id FROM table3 WHERE case_number='case_number')
-
ORDER BY name;
Against this table and same above: - table4
-
id AutoNumber (Primary Key)
-
case_number Text
-
name Memo
-
date_create Date/Time (General Date)
-
date_update Date/Time (General Date)
The syntax between the two queries is almost identical and there aren't many
differences between the tables.
There are 3 records in table4 for a case_number and only 1 is in table3, so
I would expect a return of two records. I get nothing.
If I remove the NOT IN clause it returns all three records from table4.
If I change it to IN I get the 1 record that is also in table3.
This is very strange. case_type and case_number are values taken from an active form.
I am unable to find discussion regarding SELECT queries with NOT IN clauses.
Thank you for any help.
1 3095 Rabbit 12,516
Recognized Expert Moderator MVP
When refering to controls on forms, you use:
Forms![FormName]![ControlName]
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: guitarromantic |
last post by:
Hey everyone.
I'm re-writing a php Content Management System (based loosely on
phpNuke but specific to my site). My first major change was attempting
to normalise the Review section database structure. I've created a
Staff table with staff email addresses and names (plus id), and a
Reviews table with the text of the reviews. The Reviews table contains
an 'author' field with a value that corresponds to the Staff table.
When I display a...
|
by: malcolm |
last post by:
Example, suppose you have these 2 tables
(NOTE: My example is totally different, but I'm simply trying to setup
the a simpler version, so excuse the bad design; not the point here)
CarsSold {
CarsSoldID int (primary key)
MonthID int
DealershipID int
NumberCarsSold int
|
by: kalamos |
last post by:
This statement fails
update ded_temp a
set a.balance = (select sum(b.ln_amt)
from ded_temp b
where a.cust_no = b.cust_no
and a.ded_type_cd = b.ded_type_cd
and a.chk_no = b.chk_no
group by cust_no, ded_type_cd, chk_no)
|
by: Tcs |
last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't
loaded it yet. I'm still using MS Access. And no, I don't believe this is an
Access question. (But who knows? I COULD be wrong... :) I've tried the
access group...twice...and all I get is "Access doesn't like ".", which I know,
or that my query names are too long, as there's a limit to the length of the SQL
statement(s). But this works when I don't try to...
|
by: SuffrinMick |
last post by:
Hello - I'm a newbie to coding!
I'm working on an access 2000 database which has three tables:
tblContacts - A list of customer contacts.
tblOrgTypes - A list of organisational types.
tblPositions - A list of job descriptions (Contacts can hold more than
one position)
I want to use a multi-select list box (Containing alphabetical list of
positions) to run a query. HELP!
| |
by: MLH |
last post by:
I have a table (tblCorrespondence) holding records with fields like
, , , , , ,
, etc...
About a dozen 's are defined and I often use queries to
extract records of a given . That's pretty easy.
But, recently, I wanted to list all "15" letters, a few of
the above mentioned fields and one additional field: of
nother letter "00" in the same row. That's the tough part.
|
by: bokke |
last post by:
Hi,
I have a page with a link
<a href="Contributor.php?action=&SubCat=<?php echo $row;
?>"><?php echo $row;?></a>
that does to a page with a SELECT
$query = "SELECT * FROM news WHERE writer='$SubCat' ";
|
by: zafm86 |
last post by:
Hi everyone!
I'm sure my problem is pretty easy to solve but I've been working on it for a long and my my brain is not working correctly anymore.
I'm working with an AS400 and I mhave to do an "interface" in Access. It's like a little system to make a production plan. It must get information about part numbers, description, set where the part number belongs, quantity of part numbers that the set uses, stock number(this is a text value, it...
|
by: atishrg |
last post by:
Hello All,
I am facing one strange problem..
I am using a select query in my function which will return specified product details according to product code selected by user..
here is the query..
Select p_code,p_desc from P_St where p_code = '" + cbotext + "'
for all other code selected by user it is working fine ..but when user selected a procuct code as 'c9721comp' its failed ,, when I write a select query using Like
|
by: dizzydangler |
last post by:
Hi, I'm new to access (2007, running on XP), but I've gotten some great help from this site on my project so far. However, the more I know, the more complex the problems seem to become....
I'm working with all of my data in a single table and, right now, I've got a form linked to a query that allows the user to input whatever search criteria they want through a variety of controls. I've also created a series of check boxes on the form...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |