Results of 3 queries into 1?

G

Guest

I have queries for marketing purposes which keep track of how clients heard
about our company. The query counts how many times each response (i.e.
internet, newspaper, etc.) occurs in a table of callers. I have three
seperate queries; one returns the numbers for all calls, one returns numbers
from calls in the last three months (using the DateAdd function) and one
returns numbers from calls in the last month (again using the DateAdd
function). Is there any way to view all 3 of these results in 1 query or 1
form?
 
J

Jeff Boyce

One approach might be to use a form and use the DLookup() function for three
controls (one for each of your current queries). You could use DLookup()
against each query to get the "number".

Note that if there are no records that match your query's criteria, the
query returns nothing... you'll need to wrap an Nz() function around your
DLookup() function, to handle the nulls.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

I'm not really familiar with the DLookup () function. Can you explain how i
would use that function in this case?
Thanks
 
J

Jeff Boyce

You'd be better off spending time looking at Access HELP on the topic. The
intricacies of the syntax may require you to "fiddle" with it a bit.
Examples are provided in HELP.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
D

David F. Cox

something like a group query(off top of my head, and untested) :

all: 1
3month: iif([tdate] >= [startdate] and [tdate]<
dateadd("m",3,[startdate],1,0)
1month:iif(([tdate] >= [startdate] and [tdate]<
dateadd("m",1,[startdate],1,0)

SUM those three columns


David F. Cox
 

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

Similar Threads


Top