A query is capable of displaying records containing fields from across a number of data tables. . . Types of Queries There are several types of queries in Access that are used to generate information.
Such queries are called select queries because they are used to “select” records with a given set of fields: actual and computed and also for a given criteria. There are three important query types that are required for generating the accounting reports. These queries have been discussed as below: (a) Simple Query : A select query is a simple query if it does not involve use of any query function to produce a summary of data. The criteria, if any, used in such a query is based on some constant value or values, forming an integral part of the query.
For example, a query, to find date and amount of transactions records in which an account, identified by code = ’711001’ is debited, is a simple query and is executed, using database design of Model-I by the following SQL statement : SELECT vDate, Amount FROM Vouchers WHERE Debit = ’711001 ’ In the above SQL statement, the SELECT statement is meant to specify the fields to be selected, FROM clause specifies the source of data and WHERE clause filters the records matching the condition that Debit field has code = ’711001’ (b) Parameter Queries : A parameter query prompts the user to enter parameters, or criteria through an input box, for selecting a set of records. A parameter query is useful when there is a need to repeat the same query with different criteria. The criteria, this means, is not constant as in the case of the simple query. While extracting the transactions to prepare ledger accounts, the same set of queries need be executed for different account codes.
Consider the following SQL statement : PARAMETERS AccountName Text ( ) SELECT Name FROM Accounts WHERE Code = AccountNo In the above query, the PARAMETERS clause is meant to declare the variable AccountNo. This SQL statement, when executed, prompts the user to provide the value of AccountNo.