Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cross Tab Query - Display Active Records and Automatic Refresh 2

Status
Not open for further replies.

BvCF

MIS
Nov 11, 2006
92
Currently I have the following cross tab query;
TRANSFORM Count(qryEmpAccountStatus.AcctNo) AS CountOfAcctNo
SELECT L_Employees.Username AS AssignedTo, Count(qryEmpAccountStatus.AcctNo) AS

NumAcctsAssigned
FROM L_Employees INNER JOIN qryEmpAccountStatus ON
L_Employees.Employee_ID=qryEmpAccountStatus.AssignedTo
GROUP BY L_Employees.Username
PIVOT IIf(qryEmpAccountStatus.StatusCode Is Null,"Not
Worked",qryEmpAccountStatus.StatusCode);

Results in a display on a "Manager" form in a format like the following:

AssignedTo---NumAcctsAssigned---Closed---NotWorked---Partial
John---------20------------------5-------15
Sally--------15------------------5-------8------------2
Fran---------10------------------2-------8


However, Management desires that the pivot table should display only active records and those
accounts that have been closed within the last 30 days. "Active" implies that the status
on the account is either "NotWorked","Open", "Partial" or "OnHold." If an account is closed, then
the DateClosed field will display the date that the account was closed.

How should the cross tab query be modified so that I will display all "active" accounts
and those accounts that have been closed within the last 30 days? Also, is it possible to have the cross tab query automatically refresh upon the Manager reassigning accounts?

Manager reassigns accounts by using the same "Manager" Form.

Tried to modify the query but haven't had much success. My latest attempt, as displayed
below, results in no records being displayed.


TRANSFORM Count(qryEmpAccountStatus.AcctNo) AS CountOfAcctNo
SELECT L_Employees.Username AS AssignedTo, Count(qryEmpAccountStatus.AcctNo) AS
NumEncsAssigned
FROM L_Employees INNER JOIN qryEmpAccountStatus ON
L_Employees.Employee_ID=qryEmpAccountStatus.AssignedTo
where Date() - qryEmpAccountStatus.DateClosed < 31 and qryEmpAccountStatus.StatusCode in
("NotWorked", "Open", "Partial")
GROUP BY L_Employees.Username
PIVOT IIf(qryEmpAccountStatus.StatusCode Is Null,"Not
Worked",qryEmpAccountStatus.StatusCode);
 
PHV,

Thanks for the information.

It finally worked!

After referencing several books and searching the internet, this has finally been solved!

This web site is a great resource and much appreciated!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top