I have a report that summarizes the visits made to our office. I need to be able to identify those who made their first visit to our office in a given month. There is no Yes/No field to track that as I reasoned that it is "calculated" so ergo shouldn't be stored.
However, I'm stumped on how to make my query tick off the First visit of a unique record. The current SQL is:
When I add a column with the SQL:
I get a error saying that I did not include VisitID as a part of domain aggregate. Fiddling with it only gets me the same error on PersonID.
I suppose I could use UNION query but I'm sure there is a way to make a single query with the indication that this is a unduplicated visit of the month.
Any suggestions?
However, I'm stumped on how to make my query tick off the First visit of a unique record. The current SQL is:
Code:
SELECT tblVisit.VisitID, tblVisit.VisitDate, Nz([FirstName],"") & " " & Nz([LastName],"") AS FullName, tblVisit.FirstVisit, tblVisit.NewCase
FROM tblPerson INNER JOIN (tblClients INNER JOIN tblVisit ON tblClients.PersonID = tblVisit.PersonID) ON tblPerson.PersonID = tblClients.PersonID
ORDER BY tblVisit.VisitDate, Nz([FirstName],"") & " " & Nz([LastName],"");
When I add a column with the SQL:
Code:
UDupe: IIf(First([tblClient].[PersonID]), -1, 0)
I get a error saying that I did not include VisitID as a part of domain aggregate. Fiddling with it only gets me the same error on PersonID.
I suppose I could use UNION query but I'm sure there is a way to make a single query with the indication that this is a unduplicated visit of the month.
Any suggestions?