473,385 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Delete records by AutoNumber

5
I am trying to delete some blank records (all they have is a date and the autonumber field) in a table. A select query runs fine when selecting the offending record but when I change it to a delete query I get "The search key was not found in any record" Am I standing on the right foot or what?
Mar 1 '07 #1
9 2537
Rabbit
12,516 Expert Mod 8TB
What's the SQL?
Mar 1 '07 #2
MMcCarthy
14,534 Expert Mod 8TB
I am trying to delete some blank records (all they have is a date and the autonumber field) in a table. A select query runs fine when selecting the offending record but when I change it to a delete query I get "The search key was not found in any record" Am I standing on the right foot or what?
Try this...

Expand|Select|Wrap|Line Numbers
  1. DELETE * FROM TableName
  2. WHERE FieldName Is Null;
  3.  
Mary
Mar 1 '07 #3
Mike46
5
What's the SQL?
DELETE tblAccounts.*, tblAccounts.Reference
FROM tblAccounts
WHERE (((tblAccounts.Reference)=[Enter Reference Number]));
Mar 1 '07 #4
Mike46
5
Try this...

Expand|Select|Wrap|Line Numbers
  1. DELETE * FROM TableName
  2. WHERE FieldName Is Null;
  3.  
Mary
Didn't work! The field name is not Null. The SQL is
DELETE tblAccounts.*, tblAccounts.Reference
FROM tblAccounts
WHERE (((tblAccounts.Reference)=[Enter Reference Number]));
Mar 1 '07 #5
Rabbit
12,516 Expert Mod 8TB
DELETE tblAccounts.*, tblAccounts.Reference
FROM tblAccounts
WHERE (((tblAccounts.Reference)=[Enter Reference Number]));
Try:
Expand|Select|Wrap|Line Numbers
  1. DELETE *
  2. FROM tblAccounts
  3. WHERE (((tblAccounts.Reference)=[Enter Reference Number]));
But note that this code does not do what you originally wanted in your post. It only deletes the records with the reference number that is specified by the user.
Mar 1 '07 #6
Mike46
5
Try:
Expand|Select|Wrap|Line Numbers
  1. DELETE *
  2. FROM tblAccounts
  3. WHERE (((tblAccounts.Reference)=[Enter Reference Number]));
But note that this code does not do what you originally wanted in your post. It only deletes the records with the reference number that is specified by the user.
I'll try it.
Mar 1 '07 #7
Mike46
5
I'll try it.
Sorry. No Cigar.
Mar 1 '07 #8
Rabbit
12,516 Expert Mod 8TB
If Reference is a Text field:
Expand|Select|Wrap|Line Numbers
  1. DELETE *
  2. FROM tblAccounts
  3. WHERE (((tblAccounts.Reference)= "'" & [Enter Reference Number] & "'"));
If Reference is a Numeric field:
Expand|Select|Wrap|Line Numbers
  1. DELETE *
  2. FROM tblAccounts
  3. WHERE (((tblAccounts.Reference)= Val([Enter Reference Number])));
Mar 1 '07 #9
NeoPa
32,556 Expert Mod 16PB
I am trying to delete some blank records (all they have is a date and the autonumber field) in a table. A select query runs fine when selecting the offending record but when I change it to a delete query I get "The search key was not found in any record" Am I standing on the right foot or what?
We need some proper information.
Please provide the SQL of the query you say worked.
What do you mean when you say 'Blank Records'?
We have the first part OK :
Expand|Select|Wrap|Line Numbers
  1. DELETE
  2. FROM tblAccounts
  3. WHERE ...
It's the WHERE clause which is holding us up, and for that we need the information which you haven't provided yet.
Records can look 'Blank' under a number of different circumstances. That's why we need the SQL of the query that did work to know how to determine 'Blank' in your circumstances. I've known a number of quite experienced users get confused over Nulls and Empty Strings etc.

Rabbit, A parameter isn't treated as a literal in SQL so won't need delimiters. Good thinking though.
Mar 5 '07 #10

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

Similar topics

2
by: Jacky Luk | last post by:
Hi, I can't seem to find a way to delete all records of a table. I created my tables in MySQL Query Browser, then fill them up with VC++, but some records were incorrect, And I had to recreate the...
4
by: Don Seckler | last post by:
I am building an application to track the distribution and returns of copies of magazines. Copies of a magazine that are unsold are returned by the retailer to the wholesaler. They are...
7
by: Amy | last post by:
I'm trying to add an autoincrementing id to a table based on an existing field Name, but Name has duplicated records. How can I do that in ACCESS? Thanks. Amy
4
by: KT | last post by:
Is there any one click solution that would do the trick? I would like to create a button, so the person who maintains the database can perform clean up work to delete duplicate records which...
14
by: Darin | last post by:
I have a table that I want to delete specific records from based on data in other tables. I'm more familiar with Access '97, but am now using 2003, but the database is in 2000 format. In '97, I...
9
by: DraguVaso | last post by:
Hi, I'm writing a VB.NET application who has to insert/update and delete a whole bunch of records from a File into a Sql Server Database. But I want to be able to knwo the 'result' of my ctions....
2
by: RICHARD BROMBERG | last post by:
I want to add a command button which will add a record to an Access table. I would also like to add another command button which will delete a record from the same table. I searched Google for...
17
by: (PeteCresswell) | last post by:
I've got apps where you *really* wouldn't want to delete certain items by accident, but the users just have to have a "Delete" button. My current strategies: Plan A:...
6
by: ashes | last post by:
Hi, I am creating an ecommerce website using Microsoft Visual Studio, VB.Net and MS Access 2003. I am new to VB.Net When someone wants to register on the website, they fill out a form and the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.