Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm trying to create a report from several queries.

The only difference in the querys is the calculation to determine a number of days since the date received.

 

This is the first query:

SELECT tblAPPLICATIONS.[DATE RECEIVED], tblAPPLICATIONS.MEMBER, tblAPPLICATIONS.SSN, tblAPPLICATIONS.SPECIALIST, tblAPPLICATIONS.[DAYS OLD]

FROM tblAPPLICATIONS

WHERE (((tblAPPLICATIONS.REPORTS)="TIME AGING")) And (((tblAPPLICATIONS.[DATE RECEIVED])<=Date()-182));

I want this in a report

 

Then I want the report to show the results of this query just below the results of the first query.

This is the second query:

SELECT tblAPPLICATIONS.[DATE RECEIVED], tblAPPLICATIONS.MEMBER, tblAPPLICATIONS.SSN, tblAPPLICATIONS.SPECIALIST, tblAPPLICATIONS.[DAYS OLD]

FROM tblAPPLICATIONS

WHERE (((tblAPPLICATIONS.REPORTS)="TIME AGING")) And (((tblAPPLICATIONS.[DATE RECEIVED])<=Date()-152));

 

Then I want the report to show the results of this query just below the results of the second query.

This is the third query:

 

SELECT tblAPPLICATIONS.[DATE RECEIVED], tblAPPLICATIONS.MEMBER, tblAPPLICATIONS.SSN, tblAPPLICATIONS.SPECIALIST, tblAPPLICATIONS.[DAYS OLD]

FROM tblAPPLICATIONS

WHERE (((tblAPPLICATIONS.REPORTS)="TIME AGING")) And (((tblAPPLICATIONS.[DATE RECEIVED])<=Date()-122));

 

and I want this to go on for 3 more queries just like these except for the neg. number will change. I also want the query results to be seperated from each other by a space or something. Each query uses the same fields from the same table.

 

Is this something that I should be doing with one or several queries or some other way? Could you help me understand how to do this?

 

I have tried this query but got an error message:

 

SELECT tblAPPLICATIONS.[DATE RECEIVED], tblAPPLICATIONS.MEMBER, tblAPPLICATIONS.SSN, tblAPPLICATIONS.SPECIALIST, tblAPPLICATIONS.[DAYS OLD], IIf(tblAPPLICATIONS.DATE RECEIVED)<= Date() - 182, "Period1", IIf(tblAPPLICATIONS.[DATE RECEIVED])<= Date() - 152, "Period2", IIf(tblAPPLICATIONS.[DATE RECEIVED])<= Date() - 122, "Period3", IIf(tblAPPLICATIONS.[DATE RECEIVED])<= Date() - 92, "Period4", IIf(tblAPPLICATIONS.[DATE RECEIVED])<= Date() - 62, "Period5", IIf(tblAPPLICATIONS.[DATE RECEIVED])<= Date() - 32, "Period6","Older")))))) As Period

FROM tblAPPLICATIONS

WHERE (((tblAPPLICATIONS.REPORTS)="TIME AGING")) And (((tblAPPLICATIONS.[DATE RECEIVED])<=Date()-32));

I now get this message:

Syntax error (missing operator)in query expression IIf(tblAPPLICATIONS.DATE RECEIVED)<= Date() � 182.

 

Can anyone help?

 

Thanks

 

dhsdhs

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...