Calculated Field Expression

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table that tracks the visits of guests (guest name, date of visit, etc.). I want to create a calculated field that will report the number of visits for each visitor. Visitor names are not unique and each visit is recorded as a new record (ie: guest name, date of visit)

Any help or suggestions would be appreciated

Thanks in advance.
 
Bo

Try something like

Select Guest, Count(*) as Visit
Fro
(Select Distinct Guest, Visit_Dat
From YourTable
Group by Gues

Regard
Rowan
 
Bob,

This is quite easy to do. Open a new query in design view, add the visits
table and get the visitor name and date fields, plus one more to count on
(or even one of the previous ones a second time, it doesn't matter) in the
grid (I suppose you would want to use criteria on date). Then go to menu
View > Totals, and notice the new line that appears in the grid, headed
Total. Under the name field leave the Total setting to default Group By,
then change it to Where under the date field (and add your criteria), and to
Count under the third field. Your query is ready.
A word of caution: slight spelling differences in the names (even an extra
space that you don't see!) will result in the same person appearing twice,
as two different ones. In a robust application you would have a separate
(joint) Visitors table with an ID field, and use that field instead of a
name field in your visits table.

HTH,
Nikos

Bob Mullen said:
I have a table that tracks the visits of guests (guest name, date of
visit, etc.). I want to create a calculated field that will report the
number of visits for each visitor. Visitor names are not unique and each
visit is recorded as a new record (ie: guest name, date of visit).
 
Back
Top