How to Create an SQL Delete Query in Access

Microsoft Access allows you to create SQL queries. These queries require a basic knowledge of the SQL programming language. Many users prefer creating SQL queries versus regular Access queries. More advanced queries can be created through this method than through Access's design view screen. For beginners, Access does provide the two basic clauses needed to create an SQL Delete query.

Instructions

    • 1

      Open an existing Microsoft Access database with at least one existing table. Access queries by clicking "Queries" in the main database window.

    • 2

      Open or create a new query. Open a query by highlighting the desired query and pressing "Design." Note that the query should already be a delete query or one that you wish to change to a delete query.

      Create a new query by choosing "Create a new query in design view." A blank query design window will open. Choose at least one table from the table list to select fields from.

    • 3

      Press the "Query Type" button on the query toolbar and select "Delete" to create a basic delete query. This is required if you want the correct clauses in place in SQL View. Choose any fields you want in your delete query as well for further assistance once you switch views.

    • 4

      Press the "View" button on the query toolbar. Use the drop-down arrow beside the button to select "SQL View."

    • 5

      Begin your delete query with the clause "DELETE". Type the fields you wish to delete, separated by commas, on the same line. Use the format TableName.FieldName. Press "Enter" and type the clause "FROM". Type the table name you wish to select the field names from. End the "FROM" line with a semicolon.

      For instance, a simple SQL Delete query would be typed as follows:
      DELETE SampleTable.FirstField, SampleTable.SecondField
      FROM SampleTable;

    • 6

      Add any desired criteria such as a number value or specific text by using the term "WHERE" plus your criteria within parentheses.

      For instance, the SQL Delete query would now look like the following:
      DELETE SampleTable.FirstField, SampleTable.SecondField
      FROM SampleTable
      WHERE (SampleTable.FirstField = "ThisText");

      Note that the semicolon is now at the end of the last line of the query. Semicolons are used to denote the end of the query and will only appear at the end of your last line.

Tips & Warnings

  • Table names and field names are case sensitive.

  • All SQL Delete queries must have a DELETE and FROM line. The query will not run without both.

Related Searches:

References

Resources

Comments

You May Also Like

Related Ads

Featured