Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Dupplicate Data
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
mrbernh  
View profile  
 More options Nov 8, 1:01 pm
Newsgroups: microsoft.public.access
From: mrbernh <mrbe...@discussions.microsoft.com>
Date: Sat, 7 Nov 2009 18:01:02 -0800
Local: Sun, Nov 8 2009 1:01 pm
Subject: Dupplicate Data
I am trying to create a report that will return a format for a time frame. My
program is for a landscaping business that needs to know who's lawn needs to
be cut. Since this a weekly task I need to create a list that can be given to
a crew that shows who hasn't been serviced in the past 4,5,6,7etc days. When
I run the querry and view the report it shows all visits rather then last
time they were cut. I used a expression of
<Date()-[Forms]![Work to be Completed]![DaySinceLast]

How do I eliminate the everything but the last day?


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Spencer  
View profile  
 More options Nov 9, 1:05 am
Newsgroups: microsoft.public.access
From: John Spencer <spen...@chpdm.edu>
Date: Sun, 08 Nov 2009 09:05:19 -0500
Local: Mon, Nov 9 2009 1:05 am
Subject: Re: Dupplicate Data
Hard to say without having some idea of your table structure.

The basic idea would be to construct a query that returns the latest service
date per customer and then run your query against that.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Frank H  
View profile  
 More options Nov 9, 3:01 am
Newsgroups: microsoft.public.access
From: Frank H <Fra...@discussions.microsoft.com>
Date: Sun, 8 Nov 2009 08:01:01 -0800
Local: Mon, Nov 9 2009 3:01 am
Subject: RE: Dupplicate Data
Your expression : Date()-[Forms]![Work to be Completed]![DaySinceLast],
refers to a control on a form, which inidicates that you are doing a
calculated
control on a form, and expecting it to have some effect on a query.

If you want to affect the records selected for a report, you need to apply a
criteria on the query that is the recordset for the report, which is a
separate recordset from that of the form.

Making a lot of assumptions...
if you are trying to use the above expression as the criteria in your query,
you're probably having trouble because it will use only the single value of
the expression which derives from the form's active record at the instant  
you run the report.

What would probably work better would be to create a calculated field in the
query you will use as the report recordset. The calculated field would
calculate the days since last service. Then you can put a range criteria on
that field.

Example calculated field:
DaysSinceLastService:Date()-[FieldnameOfDateOfLastService]
This should result in a number.

Example criteria for the calculated field:
Between 4 and 7

Tip: Do not try to put a criteria on a calculated field, which is itself
dependent upon some other calculated field.
--
Frank H
Rockford, IL


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
KenSheridan via AccessMonster.com  
View profile  
 More options Nov 9, 5:04 am
Newsgroups: microsoft.public.access
From: "KenSheridan via AccessMonster.com" <u51882@uwe>
Date: Sun, 08 Nov 2009 18:04:14 GMT
Local: Mon, Nov 9 2009 5:04 am
Subject: Re: Dupplicate Data
You can to use a subquery to restrict the results to where no rows within the
last n days exist for each customer, and return the MAX visit date to show
the latest visit per customer, grouping the query by customer, e.g.

SELECT [CustomerID], MAX([VisitDate]) As [Last Visit]
FROM [CustomerVisits] AS CV1
WHERE NOT EXISTS
    (SELECT *
      FROM [CustomerVisits] AS CV2
      WHERE CV2.[CustomerID] = CV1.[CustomerID]
      AND [VisitDate] >
      DATEADD("d",[Forms]![Work to be Completed]![DaySinceLast]*-1,DATE()))
GROUP BY [CustomerID];

You can of course include other columns with values distinct per customer in
the query's SELECT and GROUP BY clauses such as the customer name and address,
joining whatever tables are needed to return the relevant columns.  The
subquery only needs to use the one table, CustomerVisits in this example, and
be correlated with the outer query on the one column, CustomerID, however.

Ken Sheridan
Stafford, England

mrbernh wrote:
>I am trying to create a report that will return a format for a time frame. My
>program is for a landscaping business that needs to know who's lawn needs to
>be cut. Since this a weekly task I need to create a list that can be given to
>a crew that shows who hasn't been serviced in the past 4,5,6,7etc days. When
>I run the querry and view the report it shows all visits rather then last
>time they were cut. I used a expression of
><Date()-[Forms]![Work to be Completed]![DaySinceLast]

>How do I eliminate the everything but the last day?

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access/200911/1

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
KenSheridan via AccessMonster.com  
View profile  
 More options Nov 9, 5:09 am
Newsgroups: microsoft.public.access
From: "KenSheridan via AccessMonster.com" <u51882@uwe>
Date: Sun, 08 Nov 2009 18:09:24 GMT
Local: Mon, Nov 9 2009 5:09 am
Subject: Re: Dupplicate Data
On second thoughts you don't really need a subquery.  This should do it:

SELECT [CustomerID], MAX([VisitDate]) As [Last Visit]
FROM [CustomerVisits] HAVING MAX([VisitDate]) <=
DATEADD("d",[Forms]![Work to be Completed]![DaySinceLast]*-1,DATE()))
GROUP BY [CustomerID];

Ken Sheridan
Stafford, England

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access/200911/1


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
KARL DEWEY  
View profile  
 More options Nov 10, 9:41 am
Newsgroups: microsoft.public.access
From: KARL DEWEY <KARLDE...@discussions.microsoft.com>
Date: Mon, 9 Nov 2009 14:41:01 -0800
Local: Tues, Nov 10 2009 9:41 am
Subject: RE: Dupplicate Data
Try this --
SELECT [ClientID], Max([VisitDate] AS Last_Visit, (Date() - Max([VisitDate])
AS Days_Ago
FROM YourTable
GROUP BY  [ClientID], (Date() - Max([VisitDate])
HAVING Date() - Max([VisitDate] >3
ORDER BY (Date() - Max([VisitDate]), [ClientID];

You may not need  (Date() - Max([VisitDate]) in the GROUP BY.

--
Build a little, test a little.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google