If I delete a reord in dBase-compatible databases/tables, the records isn’t really zapped but only marked for deletion, and I can undelete it later if I need to. In A2K, a record/row deleted is lost permanently unless I wrapped it up in a transaction which will be lost too if I terminate the transaction. It is only good for rollback while the transaction is in process. Do you think it a good idea if I created a deletion marker field ala dBase so that I can use recordsets that aren’t marked for deletion? Is there a better method to keep deleted records for later retrieval if the need arises?
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Deleting records in A2K (A2K SR1)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Deleting records in A2K (A2K SR1)
- This topic has 18 replies, 6 voices, and was last updated 22 years, 9 months ago.
Viewing 5 reply threadsAuthorReplies-
WSsculshaw
AskWoody LoungerJuly 19, 2002 at 11:56 am #602180My understanding was in rdbms, once you did the delete, and then the commit, the data is gone. Ok in Access the data is still in the mdb file, until you do a compact, but I don’t know of any ‘easy’ way to get it back. If you want users to have the option to “delete“, but not actually delete the record, then your suggestion of a deletion marker seems fine. Maybe have the users look at the data using a query with a check “deletion maker = False”
You could even do a move operation, and append the “deleted” records to another table -
WScharlotte
AskWoody LoungerJuly 19, 2002 at 2:26 pm #602264In dBase, etc., there was still a chance to retrieve deleted stuff until the database had been packed. In Access, compacting removes temporary objects created by the application and otherwise reclaims resources, as well as permanently deleting objects you have “deleted”. The process is very different from an xBase pack.
-
WSHansV
AskWoody LoungerJuly 19, 2002 at 12:07 pm #602186Here is my
. I’m curious myself what others will say.
If you want to keep old records, using a marker is a good idea in itself. It’s fairly easy to build queries that filter out “deleted” records and use these for forms and reports. And it’s easy to restore a deleted record.
I have used the idea of a deletion marker in databases where the number of deleted records is relatively small.
I use 3 fields for this:- A boolean field Deleted.
- A string field that holds the name of the user who marked the record for deletion.
- A date/time field that holds the date and time the record was marked.
[/list]If the usage of your database involves adding and deleting lots of records all the time, the database might grow too much and performance might deteriorate if you just mark records.Alternatives might be to migrate records to a separate “Deleted records” table – in the same database or in a separate database. You must take special care with parent-child relations.
-
WScharlotte
AskWoody LoungerJuly 19, 2002 at 2:32 pm #602268I generally don’t bother with the date and user fields, but the Deleted field is a pretty standard method for enabling “deletions” while allowing the user to have second thoughts. Of course, you have to take extra steps to make sure they can’t really delete a record from a form, and there’s no way to do that in a table or query except by use of Access security.
-
WSHansV
AskWoody LoungerJuly 19, 2002 at 2:40 pm #602272Mostly, storing the user name and date of deletion is not very important. But it can be very handy at times. In one of my databases, “standard” users have the right to delete records (by using a custom command button that issues dire warnings etc.), but can’t see or restore “deleted” records themselves. A user came complaining to me that Access had deleted a record spontaneously. She was absolutely certain that she hadn’t deleted it herself. But the record proved that she had – three days earlier. I would have had a hard time convincing her without having the name, date and time.
-
WBell
AskWoody_MVPJuly 19, 2002 at 7:34 pm #602360That’s one of the very reasons we track user name, date and so forth. In particular, we had problems with people editing the address for the wrong person, and by doing archiving, we were able to spot a problem person, and we were also able to restore the correct data. It can be a resource hog, but it sure is useful on occasion.
-
-
WBell
AskWoody_MVPJuly 19, 2002 at 1:34 pm #602221FWIW, we use a “deleted” marker in records if there is any question about ever wanting to restore things, and we set security such that users cannot actually do the delete of a record. It takes a pretty large table to see any significant performance impact, so we don’t normally worry about that. And if we do get a really large table, we normally move it to SQL Server where we have some other tools. In that case, we typically set up an archiving process so we can see a complete history of who has changed a record, where it was changed, and when. In some cases we force a user to give us a reason for the change as well. In that case the archive table can contains multiple copies of a given record, so it can get really large. But with storage being inexpensive, it’s a great tool for users and for managing user training or performance problems.
-
WSPaulK
AskWoody LoungerJuly 19, 2002 at 8:17 pm #602374This is something I’ve been wanting to implement in my time tracking application. I get calls from users on occasion that the application mysteriously changed something and I expect it is a training issue. It would be great to be able to go into a table and see exactly what was changed by whom etc. Can you share any more info on the subject? Or should I make this a separate post?
-
WBell
AskWoody_MVPJuly 20, 2002 at 2:55 pm #602464If you are using SQL Server as the back-end of your database, triggers are the slickest way to do this kind of thing. They operate independent of the front-end, and are executed (if they exist) each time a record is inserted, changed or deleted. The details of writing triggers are beyond the scope of this forum, but you can pick up any recent SQL Server book and find out more about them.
If, on the other hand, you are running just Access, it’s far more difficult. In Access, you would need to run BeforeUpdate events on the form modifying a record, and be sure you prevented users from getting at data at the table level. Given the level of difficulty, we don’t do that much in Access back-ends. In those cases, we typically use the BeforeUpdate event to set who changed the record and when at the form level. Hope this helps.
-
WSPaulK
AskWoody Lounger -
WScharlotte
AskWoody Lounger
-
-
-
WSPaulK
AskWoody LoungerJuly 19, 2002 at 8:12 pm #602372I created an application that tracks employee vacation. I use a status field to keep track of whether they are active terminated or deleted. When the employee leaves the firm their status changes to terminated. After two years their status changes to deleted and they no longer appear on the form. This is in case they are rehired and they want there old accrual levels. The back end is on SQL server so storage is not an issue and there are not huge amounts of records.
WScharlotte
AskWoody Lounger-
WSlesoch
AskWoody LoungerJuly 23, 2002 at 1:37 am #602950I am under the impression that autonumber once given, is given, even if a record with that autonumber is removed, leaving gap in the autonumbering. I do use autonumber in my database. If I have a 100 records with the same sequential autonumber, and I removed record number 50 (also autonumber 50), the autonumber 50 will not be issued again. Or does it affect only the highest autonumber, meaning the 100th reord? If I remove record with autonumber 100, compact the database, then the first new record wii have autonumber 100. Is it what you said?
If I use autonumber as my row ID, but keep the records marked with deletion in the same table as the main one, then there will not be any problem?
-
WScharlotte
AskWoody LoungerJuly 23, 2002 at 2:06 am #602961If you remove the last record or records from the table and then compact the database, those number at the end will be reused. You could easily wind up with a record 100 in your “deleted” table and a different record 100 in your active table. If you simply mark the records as deleted using a Yes/No field and leave them in their original table, you won’t have any autonumber problems.
-
WScharlotte
AskWoody LoungerJuly 22, 2002 at 2:53 am #602707In Access, compact applies to the entire mdb, not just to a table or even all tables. Compacting a database may also get rid of oddities in code, and it’s the first thing to try if a database starts misbehaving. If by your question you mean that you have to close the database in order to compact it, that isn’t completely true. You can use the Database Utilities menu to compact the currently open database, although many, if not most, books recommend the other method. I’ve never had any problem with compacting from the open database from the menu though. Does that answer your question or did you mean something else?
-
WSlesoch
AskWoody LoungerJuly 23, 2002 at 1:44 am #602953 -
WScharlotte
AskWoody Lounger
-
Viewing 5 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
HP Pavilion Will Not Wake Up After Being Idle for Longer Period
by
WSwalterwood44
4 hours, 15 minutes ago -
Make a Windows 11 Local Account Passwordless
by
Drcard:))
3 hours, 49 minutes ago -
Ubuntu 25.04 (Plucky Puffin)
by
Alex5723
7 hours, 25 minutes ago -
24H2 fixed??
by
CWBillow
10 hours, 6 minutes ago -
Uninstalr Updates
by
jv16
12 hours, 34 minutes ago -
Apple zero days for April
by
Susan Bradley
17 hours, 58 minutes ago -
CVE program gets last-minute funding from CISA – and maybe a new home
by
Nibbled To Death By Ducks
23 hours, 29 minutes ago -
Whistleblower describes DOGE IT dept rumpus at America’s labor watchdog
by
Nibbled To Death By Ducks
1 day, 11 hours ago -
Seeing BSOD’s on 24H2?
by
Susan Bradley
18 hours, 13 minutes ago -
TUT For Private Llama LLM, Local Installation and Isolated from the Internet.
by
bbearren
1 day, 1 hour ago -
Upgrade from Windows 10 to 11
by
Holdsworth8
1 day, 19 hours ago -
Microsoft : AI-powered deception: Emerging fraud threats and countermeasures
by
Alex5723
1 day, 22 hours ago -
0patch
by
WSjcgc50
23 hours, 47 minutes ago -
Devices might encounter blue screen exception with the recent Windows updates
by
Susan Bradley
1 day, 16 hours ago -
Windows 11 Insider Preview Build 22631.5261 (23H2) released to Release Preview
by
joep517
2 days, 1 hour ago -
Problem opening image attachments
by
RobertG
2 days, 3 hours ago -
advice for setting up a new windows computer
by
routtco1001
2 days, 18 hours ago -
It’s Identity Theft Day!
by
Susan Bradley
1 day, 22 hours ago -
Android 15 require minimum 32GB of storage
by
Alex5723
2 days, 22 hours ago -
Mac Mini 2018, iPhone 6s 2015 Are Now Vintage
by
Alex5723
2 days, 23 hours ago -
Hertz says hackers stole customer credit card and driver’s license data
by
Alex5723
2 days, 23 hours ago -
Firefox became sluggish
by
Rick Corbett
15 hours, 54 minutes ago -
Windows 10 Build 19045.5794 (22H2) to Release Preview Channel
by
joep517
3 days, 3 hours ago -
Windows 11 Insider Preview Build 22635.5235 (23H2) released to BETA
by
joep517
3 days, 4 hours ago -
A Funny Thing Happened on the Way to the Forum
by
bbearren
2 days, 1 hour ago -
Download speeds only 0.3Mbps after 24H2 upgrade on WiFi and Ethernet
by
John
6 hours, 21 minutes ago -
T-Mobile 5G Wireless Internet
by
WSmmi16
2 days, 1 hour ago -
Clock missing above calendar in Windows 10
by
WSCape Sand
3 hours, 20 minutes ago -
Formula to Calculate Q1, Q2, Q3, or Q4 of the Year?
by
WSJon5
3 days, 18 hours ago -
The time has come for AI-generated art
by
Catherine Barrett
2 days, 22 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.