Query Tutorial


Access Query Tutorials

Welcome to our Access Query Tutorials and SQL Tips home page.  This page provides an introduction and summary of each of our Access query programming examples. Access query examples range from simple query commands such as insert, select & delete to more advanced concepts such as unions and dynamic code substitution. Query tutorials are listed on the left side menu.Our SQL tutorials are designed to give you the information needed to create superior Access databases through use of solid SQL coding.  Below are highlights of each the query tutorials.

SQL Query Tutorials Table of Contents

Are you looking for help with SQL/Server queries?  Access SQL queries are often identical to their SQL/Server counterpart.  We are SQL/Server experts too –contact us for help and project development.

Tutorial Link

Query Example Descriptions Access Multi-Select Parameter Forms Learn how to use multiple select parameter forms for filtering queries.  Complex queries will run fast with the multi select parameter technique. Access Query Too Complex Out of Memory! Query Too Complex! You are almost done with a query after working for hours and suddenly you are screwed by Access again.  See a workaround that may fix your query too complex error – it often works for our programmers. Access Aggregate Function Query Min, Max, Count, etc. are aggregate functions used to perform calculations in an SQL queries.  Learn the syntax of these aggregations and additional information. Access Child/Parent Table Query Retrieve master (parent) records dependent on the values in a detail (child) table.  An example of this feature would be to identify product order records where on or more of the line item details has a certain status such as out of stock, not shipped, etc. Access SQL Choose Function Advanced In these examples we explore more complex choose command usage.  We assume you have review the basic choose statement query above. Access Crosstab Query Advanced Here we show modified crosstab query examples giving ideas about further customization of these types of MS query instructions. Access Date Time &  Date Part Query Access date/time database query example is the topic of this discussion. Many types of data change over time some examples include work pay, hourly consulting rates, part costs, etc. Access SQL Delete Query Example The delete statement is a DML command which will remove one or more rows of data from a relational database table.  The number of rows deleted is dependent upon the query criteria used within the where clause of the delete query.
Access External Table Reference Linking to tables outside of the main Access database increases the flexibility of Access databases.  Here we demonstration the used of the ‘IN’ clause for dynamic table linking  Access Filter Reports Filter report records using a form field variable.  Many users and developers use filters on the report to accomplish this task however this method is less efficient. Access Group By Query The SQL group by clause is a DML command used to combine data based on the values in the fields of a table.  The Group By clause is often used in together with one or more aggregate functions. Access Having Query Clause The having clause is a DML statement used in combination with the Group By clause to limit the records retrieved based on criteria applied to the aggregate function values. Access Histogram Query In this example we demonstrate a Histogram Access query – you’ll be surprised at how easy it is to do the calculations for a seemingly complex statistical measure using a single Access query.  Access Insert Into Query The insert into SQL command is use to append or add new records to a table. The new records can be added as Values or the insert into command can be combined with a select statement to append records which already exist in other tables. Access Master/Detail Updates In this MS query code example we assume that we have two tables in a master/detail relationship.  The main table contains Tasks which much be completed.  Access Order By Query Create a dynamic SQL order by clause using an immediate if statement to change the ‘Order By’ clause of a query dependent upon user input.  Based on user input you can sort a form or report on different fields depending on a user’s input. Access SQL Query Parameters Parameter query lesson is an extension of the bottom-up query example.  The form field is used in the query to determine how far to look back in the M_Attendance table for missed work days.  Access Predicate Functions

Predicates in SQL are fairly easy to implement but are important to understand for full use of the query programming language.

Listed below are the 5 predicate functions: All, Distinct, Distinctrow, Top, and Top Percent.

Access Update Same Table Field In this Update Query example we want to update each employee’s salary by 10%.  There are at least two ways to do this query. Access Scalar SubQuery The scalar query or scalar subquery substantially simplifies what would otherwise be a complex set of queries.  This function allows retrieval of single values from a table, usually aggregate functions, from within the form clause. Access Select Query Select statement begins your basic understanding of SQL DML  in a relational database.  While the select statement starts out simple there are several optional arguments which can lead to a truly complex SQL command which can span several screens.  Access Select Top Query Have you ever had the need to get the 3rd record from a table using a query only? Access Union Query Access 2010 union query tutorial shows how to create a combo box All choice item. This technique is often used for selecting specific (or All) records for a report. Access Update Query The update statement is the DML (data manipulation language) command used to modify the data in your relational database tables. Access Query API Function Use a function in an Access query to call an API to retrieve data from a website database.

Microsoft Office:
MS Access 2000 Through Access 2016 & Office 365

Microsoft Office VBA, MS Access 2003, 2007, 2010, 2013, 2016