IT tutorials
 
Office
 

Microsoft Accesss 2010 : Enhancing the Queries That You Build - Creating and Running Action Queries (part 2) - Creating and Running Delete Queries

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Product Key Free : Microsoft Office 2019 – Serial Number
11/16/2014 8:02:55 PM

Creating and Running Delete Queries

Rather than just modify table data, Delete queries permanently remove from a table any records that meet specific criteria; they’re often used to remove old records. You might want to use a Delete query to delete all orders from the previous year, for example.

It’s important to remember that if you have turned on the Cascade Update Related Fields Referential Integrity setting and the Update query tries to modify a primary key field, Access updates the foreign key of each corresponding record in related tables. If you have not turned on the Cascade Update Related Fields setting and you have enforced referential integrity, the Update query doesn’t allow you to modify the offending records.


Build a Delete Query

To build a Delete query, follow these steps:

1.
While in a query’s Design view, select Delete from the Query Type group on the Design tab of the Ribbon.

2.
Add to the query grid the criteria you want. The query shown in Figure 3 deletes all orders with a Status ID of 3 (closed).

Figure 3. A Delete query that is used to delete all time cards entered more than a year ago.

3.
Click Run in the Results group on the Design tab of the Ribbon. The message box shown in Figure 4 appears.

Figure 4. The Delete query confirmation message box.


4.
Click Yes to permanently remove the records from the table.

The SQL behind a Delete query looks like this:

DELETE tblTimeCards.DateEntered
FROM tblTimeCards
WHERE (((tblTimeCards.DateEntered)<Date()-365));

It’s often useful to view the results of an Action query before you actually affect the records included in the criteria. To view the records affected by an Action query, you click the View button in the Results group on the Design tab of the Ribbon before you select Run. All records that will be affected by the Action query appear in Datasheet view. If necessary, you can temporarily add key fields to the query to get more information about the records that are about to be affected.


Remember that if you turn on the Cascade Delete Related Records Referential Integrity setting, Access deletes all corresponding records in related tables. If you do not turn on the Cascade Delete Related Records setting and you do enforce referential integrity, the Delete query doesn’t allow you to delete the offending records. If you want to delete the records on the “one” side of the relationship, first you need to delete all the related records on the “many” side.

 
Others
 
- Microsoft Accesss 2010 : Enhancing the Queries That You Build - Creating and Running Action Queries (part 1) - Creating and Running Update Queries
- Microsoft Accesss 2010 : Enhancing the Queries That You Build - Creating and Running Parameter Queries
- Microsoft Accesss 2010 : Enhancing the Queries That You Build - Getting Help from the Expression Builder
- Microsoft Accesss 2010 : Enhancing the Queries That You Build - Creating Calculated Fields
- Using OneNote with Other Office 2010 Applications : Entering Outlook Information (Email, Meeting, Contact, Task) on a Page
- Using OneNote with Other Office 2010 Applications : Entering Meeting Details from Outlook in a Note
- Using OneNote with Other Office 2010 Applications : Opening a Page in Word, Creating an Outlook Task in OneNote
- Microsoft Visio 2013 : A Visual Orientation to a Visual Product - Panning and zooming in Visio
- Microsoft Visio 2013 : A Visual Orientation to a Visual Product - Managing the Shapes window
- Microsoft Visio 2013 : A Visual Orientation to a Visual Product - Exploring the drawing window
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us