Solved

Compare Records

Posted on 2011-03-02
4
195 Views
Last Modified: 2012-05-11
Hello:

I have a series of records that list the person and their appointment time. I am trying to do is build a query that lists individual who had multiple appointments within 45 days.

John Smith              10/7/2009 17:51
Mike Don              4/18/2010 4:11
Mike Don              11/13/2010 23:44
Abe Abel              8/1/2010 18:19
Abe Abel              7/13/2010 12:42
Abe Abel               6/24/2010 08:34
Marshall Tucker     7/27/2010 10:30
Kim Dale               8/4/2010 22:28

Thanks
Dan
0
Comment
Question by:RecipeDan
  • 3
4 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 35018656
Need a better definition.
Do you mean.... for each appointment, did this person have an appointment within the 45 days prior to this one?

or are you specifying a particular 45 day period in which you are looking for people with more than one appointment in that period?
0
 
LVL 77

Expert Comment

by:peter57r
ID: 35018751
For the first meaning you can create a query based on your table and add an extra column which is your version of..


Dcount("*", "tablename", "Personname='" & Personname & "' and apptDate <# " & format(ApptDate, "yyyy-mm-dd") & "# and apptdate>=# " & format(apptdate-45, "yyyy-mm-dd") & "#")

set the criteria for this column to
>0
0
 
LVL 1

Author Comment

by:RecipeDan
ID: 35019044
Hi Peter57:

What I am looking at doing is take the earliest appointment and see if the person returned within 45 days.

For example Abe Abel had an appointment on 6/24/2010 08:34 that was his first appointment . He had two additional appointments on 7/13/2010 12:42 and 8/1/2010 18:19. So he would show on the list because his two additional appointments were within 45 days of the initial one.  


0
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 35054239
To see if the person returned in next 45 days you can modify the expression to..

Dcount("*", "tablename", "Personname='" & Personname & "' and apptDate ># " & format(ApptDate, "yyyy-mm-dd") & "# and apptdate<=# " & format(apptdate+45, "yyyy-mm-dd") & "#")

0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now