Code to run several queries in series

G

Guest

I have five different queries set up to determine the overdue status of a
task. For example: 30_DayFollowUp query returns all tasks that are greater
than 30 days overdue but less than 60 days over due. Similar queries are set
up for 60, 90, 120 and 180 days. Currently I have a form with five separate
command buttons that open five separate subforms corresponding to each
overdue status (30, 60, 90, 120 and 180 days). I would like to display all
data in one form with a field that indicates the days overdue. Is there code
that I can run when the form opens that will run all five queries?
 
G

Guest

Could you write a single query of >30 but <180 as the basis and sort or group
the results by the overdue field?
 
G

Guest

Good suggestion. I do think I need to re-design this. How do you group the
results and will that allow me to display everything on one form?
 
G

Guest

The other problem is that for example, currently, in the 30 Days Overdue
form, once the emails are sent the records are not visible in the 30 Days
Overdue form. This is done by code in the SendObject function 'DT_30DayNotice
= Now()' and a condition of the 30 Days Overdue query is that 'DT_30DayNotice
Is Null.' If the task is not closed, the record will reappear in the 60 Days
Overdue form after 60 days and so on. I need to be able to do the same thing
if all the records are sorted on one form. Is this possible?
 
G

Guest

First write your query. Set your Criteria to be >30 <180. In the query
window sort by asending or decending depending on how you want to view it.
Save the query
Second create a form using the query as a source. Arrange your fields. Now
select the form properties by clicking in the square in the form top left
corner and then right clicking...go to the properties option.
Under properties: Change "form view" from single view to continuous view.
this will allow you to see every record.
Save your form...you can also change your view to be datasheet view if you
like.
 
G

Guest

I haven't used SendObject myself but I think you are saying that your current
query will show you accounts overdue that have not been sent a notice. You
are using the "null" status as a flag for this.

If this is correct you'd need to re-write your query to exclude this
"Dt_30DayNotice" or the or "Closed" field flag from the results (depending on
what you are really wanting to see)...you could as well choose to sort by
date and then by one of these fields as a secondary sort so you can view them.

Another option is to write the new >30 <180 query we discussed, and then to
create a button on the top of the form. Under the buttons properties choose
"on click" and then walk through the wizard to create a filter that excludes
the flag for sent notices and/or closed files. When you do this you should
be able to see all over due accounts and then by clicking the button begin to
exclude the records you don't want.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top