I have a table with 3619 records consisting of Individuals whom have donated [DateDonated]; some individuals have multiple donations, ranging from 1 to 9 donations, with 9 the most donations. I want to display a single record of the individual and his/her donation dates; listing from left to right their donation dates; being the first donation date as “DOV1”. Then I would process to do a crosstab query on this data.
First I created a Ranking Date query as in B below from query A. Query A and B each give me 3619 records, which is the correct number of Donations. No problem here. However in query C, I have three problems in the data displayed:
1) The first two columns are fine: [Name], and [TotalDateDonated]. However, the 3rd column starts with DOV0 and then DOV1, DOV2 … DOV9. Why does the 3rd column start with DOV0?
2) I was hoping that the 1st donation date would be DOV1. Instead, if a person has donated just once, it is listed as DOV9.
3) In many cases I have some records that have blank cells between DOV entries. IE: A person has donated 3 times: DOV6 is the 1st donation date entry, DOV7 is the 2nd donation date entry and then DOV9 is the 3rd donation entry; where DOV8 was skipped. Another example: a person has donated only once, and only DOV4 has that donation date entry and DOV5 through DOV9 are empty. Still one more; there are only 4 records utilizing Column DOV0, the 3rd column; with 6 and 5 donations for each record, there are empty cells under some of the DOV’s. in each of those 4 records.
What may seem to be one of the problems in looking at the records where there are blank cells and some DOV’s are skipped, similar individuals have the “same last 4 SSN’s. The [SSN] field in the table requires that 4 of an individual’s SSN and is formatted as @@@-@@-@@@@ with a default of 0. I deleted the WHERE (((a.SSN)<>"0000") in query B and still I have the same problems. (I hope my explanation has been clear).
Query Name A: qryRC2001 Ind Visits A
SELECT [tblRed Cross 2001].[DonorID#], [LastName] & "," & Space(1) & [FirstName] & Space(1) & [Initial] AS Name, [tblRed Cross 2001].SSN, [tblRed Cross 2001].OfficeSymbol, [tblRed Cross 2001].DeptService, [tblRed Cross 2001].Phone, [tblRed Cross 2001].DateDonated
FROM [tblRed Cross 2001];
Query Name B: qryRC2001 Ind Visits B
SELECT a.Name, a.SSN, a.OfficeSymbol, a.DeptService, a.Phone, a.DateDonated, a.[DonorID#], Count(b.DateDonated) AS DateRank
FROM [qryRC2001 Ind Visits A] AS a INNER JOIN [qryRC2001 Ind Visits A] AS b ON a.SSN = b.SSN
WHERE (((a.SSN)<>"0000") AND ((Format(.[DateDonated],"yyyymmdd") & "-" & .[DonorID#])>=Format([a].[DateDonated],"yyyymmdd") & "-" & [a].[DonorID#]))
GROUP BY a.Name, a.SSN, a.OfficeSymbol, a.DeptService, a.Phone, a.DateDonated, a.[DonorID#];
Query NameC: qryRC2001 Ind Visits C
TRANSFORM Min(c.DateDonated) AS DateDonated
SELECT c.Name, Count(c.DateDonated) AS [Total DateDonated]
FROM [qryRC2001 Ind Visits B] AS c
WHERE (((c.DateRank)<=10))
GROUP BY c.Name
PIVOT "DOV" & 10-c.DateRank;
Any suggestions would be helful! Curtis….
First I created a Ranking Date query as in B below from query A. Query A and B each give me 3619 records, which is the correct number of Donations. No problem here. However in query C, I have three problems in the data displayed:
1) The first two columns are fine: [Name], and [TotalDateDonated]. However, the 3rd column starts with DOV0 and then DOV1, DOV2 … DOV9. Why does the 3rd column start with DOV0?
2) I was hoping that the 1st donation date would be DOV1. Instead, if a person has donated just once, it is listed as DOV9.
3) In many cases I have some records that have blank cells between DOV entries. IE: A person has donated 3 times: DOV6 is the 1st donation date entry, DOV7 is the 2nd donation date entry and then DOV9 is the 3rd donation entry; where DOV8 was skipped. Another example: a person has donated only once, and only DOV4 has that donation date entry and DOV5 through DOV9 are empty. Still one more; there are only 4 records utilizing Column DOV0, the 3rd column; with 6 and 5 donations for each record, there are empty cells under some of the DOV’s. in each of those 4 records.
What may seem to be one of the problems in looking at the records where there are blank cells and some DOV’s are skipped, similar individuals have the “same last 4 SSN’s. The [SSN] field in the table requires that 4 of an individual’s SSN and is formatted as @@@-@@-@@@@ with a default of 0. I deleted the WHERE (((a.SSN)<>"0000") in query B and still I have the same problems. (I hope my explanation has been clear).
Query Name A: qryRC2001 Ind Visits A
SELECT [tblRed Cross 2001].[DonorID#], [LastName] & "," & Space(1) & [FirstName] & Space(1) & [Initial] AS Name, [tblRed Cross 2001].SSN, [tblRed Cross 2001].OfficeSymbol, [tblRed Cross 2001].DeptService, [tblRed Cross 2001].Phone, [tblRed Cross 2001].DateDonated
FROM [tblRed Cross 2001];
Query Name B: qryRC2001 Ind Visits B
SELECT a.Name, a.SSN, a.OfficeSymbol, a.DeptService, a.Phone, a.DateDonated, a.[DonorID#], Count(b.DateDonated) AS DateRank
FROM [qryRC2001 Ind Visits A] AS a INNER JOIN [qryRC2001 Ind Visits A] AS b ON a.SSN = b.SSN
WHERE (((a.SSN)<>"0000") AND ((Format(.[DateDonated],"yyyymmdd") & "-" & .[DonorID#])>=Format([a].[DateDonated],"yyyymmdd") & "-" & [a].[DonorID#]))
GROUP BY a.Name, a.SSN, a.OfficeSymbol, a.DeptService, a.Phone, a.DateDonated, a.[DonorID#];
Query NameC: qryRC2001 Ind Visits C
TRANSFORM Min(c.DateDonated) AS DateDonated
SELECT c.Name, Count(c.DateDonated) AS [Total DateDonated]
FROM [qryRC2001 Ind Visits B] AS c
WHERE (((c.DateRank)<=10))
GROUP BY c.Name
PIVOT "DOV" & 10-c.DateRank;
Any suggestions would be helful! Curtis….