Counting Last Ocurrence of Name

  • Thread starter Thread starter Marc R Fienman
  • Start date Start date
M

Marc R Fienman

Hi everyone,

I have a query with a one to many relationship. For
instance I have a person's name and maybe two or three
addresses. In the query I want to create a calculated
field that puts a "1" in the last record of the same name
and either a 0 or a null value in the other records.
They are sorted by name and address. I am finding it
impossible to do this or maybe I am missing something. I
need to do this to create a data file for a merge per
Microsoft's knowledge base article 212375 which explains
how to merge conditional records but doesnt' explain the
part I asked above. Any help would be greatly appreciated.

Thanks,
Marc
 
You need to have at least one field that orders your query and is unique for
all your records that you see in the query, Call it ID and assume it is
numeric. Then add the following (untested) field in the query :
LastRecord: -(DMax("[ID]","tblWhatever","[ID]=" & [ID]")=[ID])
Where tblWhatever is the table in your query that has field ID, and gives
unique values in the query.
 
Back
Top