|
|
Up |
|
|
  |
Author: ChrisChris Date: Aug 7, 2007 11:46
I have a field called Tbl_PIP.[Requires Specs] and a field called
Tbl_PIP_Phases.Date. I want to count the items in Tbl_PIP.[Requires Specs]
but only if those items happen to fall within the after 1/1/07 or prior to
todays date.
Example: Hotel ABC has 5 items due on 7/1/07 (These would go to
Tbl_PIP.[Requires Specs]. The hotel also has 5 items due on 12/1/07 (These
would also go to Tbl_PIP.[Requires Specs]. We have approved the 5 items due
on 7/1/07 (Tbl_PIP.[Specs Approved]) but not the 5 from December.
I want the report to look like this.
Items Due Specs Approved
%%
Hotel ABC 5 5
100%%
What I'm getting is...
Items Due Specs Approved
%%
Hotel ABC 10 5
50%%
I know this is kind of confusing but any help would be appreciated!
|
| |
|
| | 14 Comments |
|
  |
Author: John W. VinsonJohn W. Vinson Date: Aug 7, 2007 13:22
On Tue, 7 Aug 2007 11:46:02 -0700, Chris discussions.microsoft.com>
wrote:
>I have a field called Tbl_PIP.[Requires Specs] and a field called
>Tbl_PIP_Phases.Date. I want to count the items in Tbl_PIP.[Requires Specs]
>but only if those items happen to fall within the after...
|
| Show full article (1.46Kb) |
|
| | no comments |
|
  |
Author: ChrisChris Date: Aug 8, 2007 06:32
SELECT Tbl_Hotels.ID, Tbl_Hotels.[Prop Code], Tbl_Hotels.[Property Name],
([CountofSpec Approval Date]/[CountofRequires Specs]) AS [Percent Approved],
IIf(Tbl_Hotels![Contractual Reno]=True,"Contractual Reno","Non-Contractual
Reno") AS [Reno Type], Count(Tbl_PIP.[Requires Specs]) AS [CountOfRequires
Specs], Count(Tbl_PIP.[Spec Approval Date]) AS [CountOfSpec Approval Date]
FROM Tbl_PIP INNER JOIN (Tbl_Hotels INNER JOIN (Tbl_Inspect INNER JOIN
Tbl_PIP_Phases ON Tbl_Inspect.InspectionID = Tbl_PIP_Phases.InspectionID) ON
Tbl_Hotels.ID = Tbl_Inspect.[Hotel ID]) ON (Tbl_PIP.InspectionID =
Tbl_PIP_Phases.InspectionID) AND (Tbl_PIP.InspectionID =
Tbl_Inspect.InspectionID)
WHERE (((Tbl_PIP.[Requires Specs])=True) AND ((Tbl_Inspect.Status)="Reno")
AND ((Tbl_PIP_Phases.Date)>=#1/1/2007#) AND...
|
| Show full article (2.71Kb) |
| no comments |
|
  |
Author: John W. VinsonJohn W. Vinson Date: Aug 8, 2007 08:53
On Tue, 7 Aug 2007 11:46:02 -0700, Chris discussions.microsoft.com>
wrote:
>I have a field called Tbl_PIP.[Requires Specs] and a field called
>Tbl_PIP_Phases.Date. I want to count the items in Tbl_PIP.[Requires Specs]
>but only if those items happen to fall within the after 1/1/07 or prior to
>todays date.
>
>Example: Hotel ABC has 5 items due on 7/1/07 (These would go to
>Tbl_PIP.[Requires Specs]. The hotel also has 5 items due on 12/1/07 (These
>would also go to Tbl_PIP.[Requires Specs]. We have approved the 5 items due
>on 7/1/07 (Tbl_PIP.[Specs Approved]) but not the 5 from December.
The problem is probably with the OR clause retrieving records you aren't
expecting - parenthesis nesting can be tricky! Let's untangle the WHERE clause
here:
|
| Show full article (1.97Kb) |
| no comments |
|
  |
Author: ChrisChris Date: Aug 8, 2007 09:12
John,
That worked really well, the only problem is that I have a hotel that has
data and the Tbl_PIP_Phases.[Prior to Opening]) is true, yet nothing
displays. Any suggestions?
"John W. Vinson" wrote:
> On Tue, 7 Aug 2007 11:46:02 -0700, Chris discussions.microsoft.com>
> wrote:
>
>>I have a field called Tbl_PIP.[Requires Specs] and a field called
>>Tbl_PIP_Phases.Date. I want to count the...
|
| Show full article (2.30Kb) |
| 1 Comment |
|
  |
Author: John W. VinsonJohn W. Vinson Date: Aug 8, 2007 11:42
On Wed, 8 Aug 2007 09:12:05 -0700, Chris discussions.microsoft.com>
wrote:
>John,
>
>That worked really well, the only problem is that I have a hotel that has
>data and the Tbl_PIP_Phases.[Prior to Opening]) is true, yet nothing
>displays. Any suggestions?
>> (
>> ((Tbl_PIP.[Requires Specs])=True)
>> AND
>> ((Tbl_Inspect.Status) IN ("Reno", "NC-Reno"))
>> AND
>> ((Tbl_PIP_Phases.[Date]) BETWEEN DateSerial(Year(Date()), 1, 1) AND Date())
>> AND
>> (( Tbl_Hotels.Country)="US")
>> AND
>> ((Tbl_PIP_Phases.[Prior to Opening])=True)
>> )
|
| Show full article (0.88Kb) |
| no comments |
|
  |
Author: ChrisChris Date: Aug 8, 2007 11:50
The only problem with that is I want the record to display if the
Tbl_PIP_Phases.[Date] is between our criteria OR if Tbl_PIP_Phases.[Prior to
Opening] is True.
"John W. Vinson" wrote:
> On Wed, 8 Aug 2007 09:12:05 -0700, Chris discussions.microsoft.com>
> wrote:
>
>>John,
>>
>>That worked really well, the only problem is that I have a hotel that has
>>data and the Tbl_PIP_Phases...
|
| Show full article (1.12Kb) |
| no comments |
|
  |
Author: John W. VinsonJohn W. Vinson Date: Aug 8, 2007 13:05
On Wed, 8 Aug 2007 11:50:01 -0700, Chris discussions.microsoft.com>
wrote:
>The only problem with that is I want the record to display if the
>Tbl_PIP_Phases.[Date] is between our criteria OR if Tbl_PIP_Phases.[Prior to
>Opening] is True.
Sorry... as I say, I don't know the details of your database and you did not
post the logic so I guessed, and guessed wrong. Do the other criteria apply in
either case?
John W. Vinson [MVP]
|
| |
| no comments |
|
  |
Author: ChrisChris Date: Aug 8, 2007 14:26
John,
All the other requirements are true for all cases.
"John W. Vinson" wrote:
> On Wed, 8 Aug 2007 11:50:01 -0700, Chris discussions.microsoft.com>
> wrote:
>
>>The only problem with that is I want the record to display if the
>>Tbl_PIP_Phases.[Date] is between our criteria OR if Tbl_PIP_Phases.[Prior to
>>Opening] is True.
>
> Sorry... as I say, I don't know the details of your database and you did not
> post the logic so I guessed, and guessed wrong. Do the other criteria apply in
> either case?
>
> John W. Vinson [MVP]
>
|
| |
| no comments |
|
  |
|
|
  |
|
|
|
|
|