K
Katherine
Hi,
My latest challenge is figuring out how to filter based on a calculated
field. Can you help? I included lots of detail...
I'm working at a theatre currently. In table MailingList, I have a
field which keeps track of how many years people were season tickets
holders prior to this year. In table SeasonTickets, I keep track of
how many season tickets each subscriber purchased for the current
season.
I created a series of queries to add these things together. The first
selects a distinct season from the SeasonTicket table:
SELECT DISTINCT Season, MailingListID
FROM SeasonTickets;
Then I created a count query to count the number of Seasons per
MailingListID:
SELECT MailingListID, COUNT(MailingListID) AS SeasonCount
FROM [SelectDistinctSeasons Query]
GROUP BY MailingListID;
Then I added this result to the number of years stored in MailingList
to get a total number of years:
SELECT [UnionSeasonCount Query].MailingListID, Sum([UnionSeasonCount
Query].OldSubscriptionYears) AS [Subscriber Years]
FROM [UnionSeasonCount Query]
GROUP BY [UnionSeasonCount Query].MailingListID
HAVING ((([UnionSeasonCount Query].MailingListID)=[Forms]![Mailing List
Form]![MailingListID]));
I made a subform for this query to include on the main form, and my
fellow employees would love to be able to filter by [Subscriber Years],
but I just don't know how to make it work. Is this possible? How do I
do it?
Thanks for the help!
Katherine
My latest challenge is figuring out how to filter based on a calculated
field. Can you help? I included lots of detail...
I'm working at a theatre currently. In table MailingList, I have a
field which keeps track of how many years people were season tickets
holders prior to this year. In table SeasonTickets, I keep track of
how many season tickets each subscriber purchased for the current
season.
I created a series of queries to add these things together. The first
selects a distinct season from the SeasonTicket table:
SELECT DISTINCT Season, MailingListID
FROM SeasonTickets;
Then I created a count query to count the number of Seasons per
MailingListID:
SELECT MailingListID, COUNT(MailingListID) AS SeasonCount
FROM [SelectDistinctSeasons Query]
GROUP BY MailingListID;
Then I added this result to the number of years stored in MailingList
to get a total number of years:
SELECT [UnionSeasonCount Query].MailingListID, Sum([UnionSeasonCount
Query].OldSubscriptionYears) AS [Subscriber Years]
FROM [UnionSeasonCount Query]
GROUP BY [UnionSeasonCount Query].MailingListID
HAVING ((([UnionSeasonCount Query].MailingListID)=[Forms]![Mailing List
Form]![MailingListID]));
I made a subform for this query to include on the main form, and my
fellow employees would love to be able to filter by [Subscriber Years],
but I just don't know how to make it work. Is this possible? How do I
do it?
Thanks for the help!
Katherine