The newly named query now appears as ‘qryBookAuthor’ under the Query Objects in the example below.įrom the Query menu, click Run to view the results of the query. In the example below, the query has been names qryBookAuthor. It is customary to preface your query name with the words ‘qry’.
MS ACCESS QUERIES CODE
JET can also call Visual Basic for Applications code (VBA.). A ‘Save As’ pop up box will appear that will ask for the Query Name. JET/ACE (the query engine in Access) uses Structured Query Language (SQL), as many databases do. In order to save the query, click on the ‘Save’ button on the toolbar at the top of the screen.
The query design window should appear as in the following example. Clicking on the * is the equivalent of selecting all the fields from a particular table. In the Author table field list in the top half of the query design window, double-click the *. In the Book table field list in the top half of the query design window, double-click on each field to add the following fields: BookID, BookName, AuthorID. Types of Queries Advanced Filter/Sort: The simplest kind of query, Advanced Filter/Sort allows you to find and sort information from a single table in the. If you sort by multiple fields in the query design view in Access, the order of the sorting is applied by. Then use the drop-down that appears to select either Ascending or Descending order. As you can see in the example below, both the Author and Book tables have been selected and now appear in the top half of the query design window. To sort a query in Access in the query design view, click into the Sort row of the field in the QBE grid by which to sort the result set. When all of the tables have been selected, click on the ‘Close’ button to close the ‘Show Table’ screen. The above should be repeated for each table you want included in your query. Select the table name and click on the ‘Add’ button. The ‘Show Table’ screen will appear similar to the example below with a list of tables in the database. Double-click on ‘Create query in Design view’. Under the Microsoft Access View menu, point to Database Objects, and then select Queries.