C
Carl Rapson
I've got a table with the following structure (I realize it's not properly
normalized, but I plan to do that after I get this problem solved):
tblRatingData
-------------
[Vendor ID], Long
[Rating Date], Date/Time
[Full], Yes/No
[Quality Rating], Double
[Delivery Rating], Double
The field [Full] is set to Yes (True) if the [Rating Date] corresponds to a
full rating recalculation (individual vendors can have their ratings
recalculated at any time; a full recalculation does all vendors at the same
time). My basic goal is to pull from the table the ratings for all vendors
from the last full rating recalculation date. I have this working, with the
following set of queries:
Query1
------
SELECT MAX(tblRatingData.[Rating Date]) AS [Last Full Rating Date]
FROM tblRatingData WHERE tblRatingData.Full=True;
Query2
------
SELECT tblRatingData.[Vendor ID],tblRatingData.[Rating
Date],tblRatingData.[Full],tblRatingData.[Quality
Rating],tblRatingData.[Delivery Rating]
FROM tblRatingData INNER JOIN Query1 ON tblRatingData.[Rating
Date]=Query1.[Last Full Rating Date];
So far, so good. What I would like to do now is add to my data set another
field containing the number of records in tblRatingData for each vendor with
a [Rating Date] greater than the last full rating date I'm working with, if
that's clear. That will tell me if the vendor has had its ratings
recalculated since the last Full rating calculation. I've tried to do this
with an embedded subquery, as follows:
Query3
------
SELECT A.[Vendor ID],A.[Rating Date],A.[Full],A.[Quality Rating],A.[Delivery
Rating],(SELECT COUNT(*) FROM tblRatingData WHERE [Vendor ID]=A.[Vendor ID]
AND [Rating Date]>A.[Rating Date]) AS [More Recent]
FROM Query2 A;
Unfortunately, Access crashes with the dreaded 'Microsoft Access has
encountered a problem and needs to close' message when I try to run the
query. Can someone give me a clue as to the syntax for doing something like
this (an embedded subquery as a field)? Is it even possible? I can try to
provide more details if needed.
Thanks for any assistance,
Carl Rapson
normalized, but I plan to do that after I get this problem solved):
tblRatingData
-------------
[Vendor ID], Long
[Rating Date], Date/Time
[Full], Yes/No
[Quality Rating], Double
[Delivery Rating], Double
The field [Full] is set to Yes (True) if the [Rating Date] corresponds to a
full rating recalculation (individual vendors can have their ratings
recalculated at any time; a full recalculation does all vendors at the same
time). My basic goal is to pull from the table the ratings for all vendors
from the last full rating recalculation date. I have this working, with the
following set of queries:
Query1
------
SELECT MAX(tblRatingData.[Rating Date]) AS [Last Full Rating Date]
FROM tblRatingData WHERE tblRatingData.Full=True;
Query2
------
SELECT tblRatingData.[Vendor ID],tblRatingData.[Rating
Date],tblRatingData.[Full],tblRatingData.[Quality
Rating],tblRatingData.[Delivery Rating]
FROM tblRatingData INNER JOIN Query1 ON tblRatingData.[Rating
Date]=Query1.[Last Full Rating Date];
So far, so good. What I would like to do now is add to my data set another
field containing the number of records in tblRatingData for each vendor with
a [Rating Date] greater than the last full rating date I'm working with, if
that's clear. That will tell me if the vendor has had its ratings
recalculated since the last Full rating calculation. I've tried to do this
with an embedded subquery, as follows:
Query3
------
SELECT A.[Vendor ID],A.[Rating Date],A.[Full],A.[Quality Rating],A.[Delivery
Rating],(SELECT COUNT(*) FROM tblRatingData WHERE [Vendor ID]=A.[Vendor ID]
AND [Rating Date]>A.[Rating Date]) AS [More Recent]
FROM Query2 A;
Unfortunately, Access crashes with the dreaded 'Microsoft Access has
encountered a problem and needs to close' message when I try to run the
query. Can someone give me a clue as to the syntax for doing something like
this (an embedded subquery as a field)? Is it even possible? I can try to
provide more details if needed.
Thanks for any assistance,
Carl Rapson