microsoft.access.courses - combined multiple queries

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Access Training and help » microsoft.access.courses - Combined multiple queries

microsoft.access.courses - Combined multiple queries

resolvedResolved · Low Priority · Version Standard

Amanda has attended:
No courses

Combined multiple queries

Hello. This is a complicated one.

I've built a database (Access 2003) to capture customer information for a new product. The database has integrated a so-called process management function. In essence, at each customer level (form), and for each task, there are

1. a 'due date' (pre-set date that a task has to be done)
2. a 'competion date' (when the task has been done, customer advisor inputs the date in the field)

All the above is working perfectly fine at the customer level.

However, problem arises in the reporting level...



I need a combined view of the process management for all customers. I have tried to do this by creating an individual select query for each task. Note: there are 20 tasks in total. So if the task has not been done before the due date, it will be considered as 'overdue'.

The query criteria is as follows:

if due date < today's date
and
if completion date is null
then
the 'due date' will appear

I have created 20 seperate queries for all tasks, and they work completely fine independently.

When I tried to combine them into one big query, overdue tasks DO appear at the customer level (row), which is great. However, tasks that are NOT overdue also appear at the customer level even though not one task is overdue.



My question is: Is there any way to fiddle with the structure of my query/queries to prevent empty rows from appearing in the combined query? Or is there any way that I can overcome this problem by restructuring my queries?


Heaps of thanks!

Amanda

RE: Combined multiple queries

Amanda,

Yes I agree quite complex. Without seeing the queries you have written I cannot be a 100% this is the error, but I think that you have an error in your SQL. It seem like you have created a number of separate queries and then combined them.

I would suggest that in you SQL you need to implement embedded/sub queries (an SQL statement inside an SQL statement). This means that you inner most query will execute first and the outermost last. By using this method you should reduce the number of separate SQL statements.
e.g
SELECT SUM(Mysum) FROM My_Information
WHERE My_name IN
(SELECT My_name FROM My_Place
WHERE my_region = 'value')

To solve the empty rows you just need to do a check to make sure the cell is not equal to null.

Hope this helps
David

 

Training courses

 

Training information:

See also:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Access tip:

Convert A Form Into A Report

If there is a form that you want to to save as a report:

1. Open that form in Design View
2. Select File and Save As
3. In the Save As Dialog box Select Report

The system creates a report based on the form.

View all Access hints and tips


Server loaded in 0.09 secs.