Topics Search

Problem Deleting Records Using Custom Delete Sequence

Problem Deleting Records Using Custom Delete Sequence
Views: 0
I've developed a custom delete sequence that I think many people could benefit from. The problem is that it's not working properly and I can't figure out why not.

The goal is that if a user deletes an invoice, the user is prompted for a reason for the deletion and then the cancelled invoice is logged with the Invoice Number, Client Name, Amount and Reason for deletion.

This makes auditors (and accounting and management) happier rather than just see missing invoices and it's more user-friendly than just not allowing people to deletetheir mistakes.

Here's how I implemented it:
Sponsored Links:

More topics

 

When deleting one record its deleting record from another table

Preview
Having problems when I delete a record from my tenants table.
Two tables one property to many tenants is my relationship with enforced referential integrity ticked and cascade update ticked and I took the cascade delete off.

Problem: When I delete a tenant from tenant table it is also deleting the whole property record from the property table also. I know it is not correct to delete records but its just in case of wrong information being recorded and its bugging me why this is happening when cascade delete is turned off.
 

Delete Query Deleting Too Much

Preview
Importing data to a table each week that can sometimes include duplicate records, I created a duplicate query. It works well to identify those records that are duplicated, but instead of deleting the extra copies and leaving one it proceedes to delete them all.

Any advice? Is there a better technique than the delete query
 

Delete one or more records from a database

Preview
Deleting inaccurate or obsolete data can make your database faster and easier to use. For example, if you move data from the previous calendar or fiscal quarter to a set of archive tables in another database, you can reduce the size of your working database and help it run faster. If you remove inaccurate or duplicate data, you can reduce business costs.
This article explains how to delete data from a Microsoft Office Access 2007 database. It also explains how to delete data from individual fields a relatively simple process, and how to delete entire records a process that can be much more complex. the article also explains how to delete data manually, and how to use delete queries.
In this article
* About deleting data
* Delete the data in a field
* Delete the data in a list
* Delete unrelated records from a database
* Delete related records from a database
* Delete tables from a database
* Sample criteria for select queries
 

Linking table and Deleting one

Preview
If I delete linked table linked to maindb in frontend db will this cause problem to the maindatabase data? [not deleting the datas within the table - but deleting the whole table?]

What will happen if I delete table and keep on relinking it back? Can action like this cause any problem to the front end of even maindb?

Also is there anything special I need to keep in mind while linking tables across databases
 

Delete Duplicate Records From Access Tables

Preview
Yes, deleting duplicates should be easy, but it's not. A Google search for newsgroup posts about deleting duplicates scored over 2500 hits. Clearly, this is a common problem.
The confusion is compounded, no doubt, by the existence of the built-in Find Duplicates query wizard. While this wizard does a great job of helping you identify duplicates, it does not provide a way to delete them. Many posts at the newsgroup included frustrated comments like this: "I can see them, but I can't delete them!"
 

Use queries to delete one or more records from a database

Preview
This article explains how to delete data from an Microsoft Office Access 2007 database by using update and delete queries. You use an update query to delete individual fields from the records in a database, and you use a delete query when you need to remove entire records from a database, including the key value that makes the record unique. As you proceed, remember that Access also provides a number of ways to delete part or all of a record manually.
For more information about deleting records manually, see the article Delete one or more records from a database.
In this article
* Understand using queries to delete data
* Plan the deletion
* Stop Disabled Mode from blocking a query
* Delete partial records (one or more fields)
* Delete entire records
* Sample criteria for select queries
 

Delete Query deleting more records than Subquery Returns

Preview
The following Delete Query is deleting all records, but I need it to delete only records returned by the subquery.

The subquery correctly returns records when I test it without the Delete operation. Could I be implementing the Delete Query incorrectly?

DELETE tblCheck.fldPrimary
FROM tblCheck
WHERE EXISTS (SELECT tblCheck.fldPrimary, tblCheck.fldPkg, tblCheck.fldAuditDate
FROM tblCheck INNER JOIN tblImportCheck ON (tblCheck.fldPkg=tblImportCheck.fldPkg AND tblCheck.fldAuditDate=tblImportCheck.fldAuditDate
 

Error handling when deleting records with button

Preview
It's been 8 years since I've taken a Visual Basic class and I'm a bit rusty. Just starting to use VBA for a db I'm designing.

I have a multiple items form with a tabular layout. When this form is loaded, it filters in only at a few select records.

At the bottom, I added a "Delete Button" which allows the user delete one of the above current records with:

DoCmd.SetWarnings False 'Removes warning box on deletion
DoCmd.RunCommand acCmdDeleteRecord 'Deletes current record
DoCmd.SetWarnings True 'Reinstates warnings before deleting

However, if there is no record to be deleted (either they have already all been deleted or there is no records to begin with) and the user hits the Delete Button, the program flips out. How can I have it catch that, so if there are no records to be deleted a MsgBox says "There are no records to be deleted" and the delete does not run?
 

Whats the easiest way to delete a record with related records?

Preview
I was reading that cascade delete option will do this, but is that only if you are deleting the record right from the table?

I want to have a button click event that will delete the record and all related records.anybody have any examples or ideas on how this would work?
 

Deleting Multiple Areas

Preview
I have a form that comprises of Sub forms within tab controls.

I have placed a delete button on the main form to remove any unwanted records. There is a problem with this. You are not able to delete a main record when a child record exists in related tables.

How can I achieve this using a click function