Microsoft Access
  Home arrow Microsoft Access arrow Page 4 - Getting to Know Microsoft Access, Part 6: ...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MICROSOFT ACCESS

Getting to Know Microsoft Access, Part 6: Advanced Queries and SQL
By: Sage Adams
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 18
    2005-01-12

    Table of Contents:
  • Getting to Know Microsoft Access, Part 6: Advanced Queries and SQL
  • AutoLookup Queries
  • Update Queries
  • Delete Queries
  • SQL (Structured Query Language)

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Getting to Know Microsoft Access, Part 6: Advanced Queries and SQL - Delete Queries


    (Page 4 of 5 )

    Delete queries are very dangerous: always make a backup of the data you plan to delete before you run a delete query! The delete query removes entire records, not just selected fields.

    To create a delete query that deletes from only one table, start a new query, choose the table from which you wish to delete records, and choose the Query | Delete Query menu option. Drag the asterisk from the field list to the query grid; the Delete cell now shows "From." Next, drag the field that has the value indicating a record should be deleted into the query grid and enter the appropriate expression in the Criteria cell. Save and run the query to perform the operation. When you create a delete query the design view looks similar to the following:

    Microsoft Access Part 6: Advanced Queries and SQL

    To delete from multiple tables you will need to run multiple delete queries (assuming the relationship between the related tables doesn’t have the Cascade Delete Records option selected). First you’ll delete the records from the table on the “many” side followed by the records from the table on the “one” side. To do this, choose the Delete Query option as you did previously. Then drag the field to use for criteria to the grid and drag the asterisk from the field's lists of the tables on the “many” side to the query grid. Run the query. Next, remove the “many” side tables from the Query window and drag the asterisk from the “one” table to the query grid and run it again.

    Make-Table Queries

    Make-Table queries are useful for a variety of purposes including the following:

    • Controlling exported information so that confidential data is not included in the new table.

    • Using as a record source for a report of events occurring during a specific time period.

    • Replacing records in an existing table with new records.

    • Exporting information from related tables to other programs such as Excel.

    • Exporting records to another database.

    You create a Make-Table query by starting a new query, as before, choosing the tables or queries from which you want to take your records, and selecting the Query | Make-Table Query menu option. Next you enter a name for the table you are making. If you choose a table that already exists then any data in that table will be replaced by the new data. Drag the fields you want to put in the new table from the field lists and put them into the query grid. Run and save the query. When you create a make-table query the design view looks similar to the following:

    Microsoft Access Part 6: Advanced Queries and SQL

    More Microsoft Access Articles
    More By Sage Adams


     

    MICROSOFT ACCESS ARTICLES

    - Linking SQL Express 2005 Tables to MS Access...
    - Working with Access Projects in Access 2007
    - Exploring Access 2007
    - Working with Stored Procedures in an MS Acce...
    - Creating and Using Action Queries
    - Creating Data Access Pages with Charts using...
    - Advanced Ideas using VBA
    - VBA Details
    - Updating Records in MS Access
    - Using ADO`s Record Object with URLs
    - Exporting XML from MS Access 2003
    - Importing XML into MS Access 2003
    - On Using Pass-through Queries in MS Access
    - Distributed Queries in MS Access
    - Configuring a Linked Microsoft Access Server...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway