Access Queries often depend on other Access Queries, often sets of queries can have common elements.
If for reasons of performance qryCalculateRevenue is to be converted to either a Pass-Through Query or View, then qrySelectCustomer will need to be at the very least made into a view with the same name.
You would then have the choice of also converting qryMailingList or living with both an Access Query called qrySelectCustomers and a SQL Server View called qrySelectCustomers.
In applications with several hundred or thousand queries this can become a big task, which is why you could consider only converting Queries which are causing a problem.
You need to answer several questions in order to scope the work required in attempting to convert a query.
Once you decide to convert a complex query, you will more than likely end up converting a set of queries, or possibly multiple sets.
There are some special factors to look at when considering the work required to convert a query.
The remainder of this article expands on the last point, replacing IIF Functions.
The following techniques make for a good choice when converting IIF statements, as they follow a very similar structure to IIF structures.
Firstly let us look at a simple Access Query using an IIF Statement
SELECT Customers.CompanyName,
The CASE statement can take one of two forms depending upon what you are trying to do, these statements can also be nested like IIF functions.
The example below shows what is known as the Simple CASE structure, which is appropriate when you have a set of possible different values, with different outcomes.
SELECT Customers.CompanyName,The second example below uses a Searched CASE structure and is of particular use when testing for null.
SELECT Customers.CompanyName,Your choice from the above depends upon the detailed syntax of your IIF statements.
Another very useful function in this context is the COALESCE function, which allows you to select the first non-null value which is very useful in protecting arithmetic calculations. For example the following will either take the field value or when null use a value of 1.
COALESCE([TheField],1)
Using the above example we could have converted the IIF function as follows.
SELECT Customers.CompanyName,The sample code can be downloaded from here Access 2000 Database.
by Andrew Couch Office Access MVP, Director ASC Associates
andy@ascassociates.biz