473,480 Members | 1,885 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Delete query cannot find required entry

11 New Member
I want to delete entry in table [tBuy Invoice] where linked table [tBuys] has no record. Statement is -
-----------
DELETE [tBuy Invoice].*
FROM [tBuy Invoice]
WHERE ((([tBuy Invoice].BuyInvcID)
In (
SELECT [tBuys].[BuyInvcID]
FROM [tBuys]
WHERE [tBuys].[BuyID] Is Null
)));
-------------
But the Delete query do not find any entry. I think it is because 'Is Null' do not return 'no entry list', but what can be done?

Thanks
Aug 1 '12 #1
4 1365
twinnyfo
3,653 Recognized Expert Moderator Specialist
AbbasBD,

I would use a LEFT JOIN Query, which lists all records from [tBuy Invoice], whether there is amatching record in [tBuys] or not. Then, set the criteria for [tBuys].[BuyInvcID] Is Null, to only return the records that don't have a corresponding record in [tBuys]

Expand|Select|Wrap|Line Numbers
  1. DELETE [tBuy Invoice].*, tBuys.BuyInvcID
  2. FROM [tBuy Invoice] 
  3. LEFT JOIN tBuys 
  4. ON [tBuy Invoice].BuyInvcID = tBuys.BuyInvcID
  5. WHERE tBuys.BuyInvcID Is Null;
  6.  
Hope this helps!
Aug 1 '12 #2
Rabbit
12,516 Recognized Expert Moderator MVP
I have no idea what this means:
'Is Null' do not return 'no entry list'
What is a 'no entry list'? You need to define the terms that you're using.
Aug 1 '12 #3
AbbasBD
11 New Member
twinnyfo

exact solution!

thanks
Aug 1 '12 #4
AbbasBD
11 New Member
Rabbit

For 'no entry list' I meant tBuys has no record corresponding to specific entry in [tBuy Invoice].

Thanks for your reply.
Aug 1 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
7389
by: Bill Murray | last post by:
I am using VS.NET 2003 and trying to deploy a service program(c++) to a Windows 2000 Server system. I have also written a small DLL (USSsetup.dll) that is used to start/stop the service using a...
2
11182
by: Joe Del Medico | last post by:
I have two tables A & B and I want to delete all the records in A that are not in B. Can I do this in the query builder? It seems like a simple problem. I can easily find the records in A that...
6
1933
by: Mark Reed | last post by:
Hi all, Please help. I have a table with 2 fields of which I am trying to change a select query into a delete query. the select query is: SELECT Table1.Date, Min(Table1.Ball) AS MinOfBall...
13
2824
by: forbes | last post by:
Hi, I have a user that used the Query Wizard to create a query in Access. Now she claims that her master table is missing all the data that was excluded from the query. Can you create anything...
1
2008
by: JC | last post by:
Hello, I am trying to change a select, find duplicates, query into a delete query. I want to get rid of the records in the main table "tblHurnsHistory." I changed the Find Duplicates query to...
3
3791
by: Kevin M | last post by:
I have one table and have created a form from that table. Also, I have created a delete query. I want to but a button on the form which will delete all records from the table; however, I cannot get...
1
1560
by: austin1539 | last post by:
-Access 2002 -Windows XP Pro Trying to run a DELETE Query to delete each entry in the table 'Data' where the field 'AssocID' matches the field 'AssocID' in the table 'Queries' and the date is...
3
1768
by: jpatchak | last post by:
The following select query gives me the set of records I want to delete: SELECT tblCaseNumbers.* FROM (tblCaseNumberDump INNER JOIN ON tblCaseNumberDump.SSN = .) INNER JOIN tblCaseNumbers ON . =...
2
6637
by: karinmorena | last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is: Week5MortgageGUI.java:151:cannot find symbol symbol: method allInterest(double,double,double)...
6
3652
by: warpcon | last post by:
Im trying to build a database starting with one of the templates that come with access. I took out the employee part in all the tables and forms. Now when I pull up a workorder and then try to view...
0
7049
marktang
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,...
0
7052
Oralloy
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,...
1
6744
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...
0
6981
tracyyun
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...
0
3000
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2989
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1304
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 ...
1
565
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
188
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.