A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Picking only the latest entry?



 
 
Thread Tools Display Modes
  #1  
Old May 27th, 2010, 04:59 PM posted to microsoft.public.access.forms
Pascoe via AccessMonster.com
external usenet poster
 
Posts: 32
Default Picking only the latest entry?

Hi Folks,

I want to pick out of a table only the latest entry that meets my criteria,
and I don't know how to.

I have properties (as a table), and I have property expenses (also as a table)
. I would like to display a report where for each property there is the
latest entry for electric bill, latest entry for gas bill, latest entry for
service charge etc. i.e. the criteria is bill = electric, date = most recent

I am at a loss as to how to go about the instruction for "most recent" entry.


As ever, any help gratefully received.

Kind Regards,
Russell.

--
Message posted via http://www.accessmonster.com

  #2  
Old May 27th, 2010, 05:23 PM posted to microsoft.public.access.forms
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Picking only the latest entry?

Russell

Access stores data in tables rather like a "bucket o' data" -- there is no
readily-apparent order.

For Access to give you "the latest entry" requires that you tell Access how
to determine what "latest" means.

I'm assuming you mean "most recent". If so, you'll need to tell Access
which (date/time) field to use to determine "most recent".

You mention "bills" on properties ... are you only interested in when the
bill came in, or also when it is/was due, when it was paid, etc...?

More info, please...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Pascoe via AccessMonster.com" u43716@uwe wrote in message
news:a8a2fdf02a983@uwe...
Hi Folks,

I want to pick out of a table only the latest entry that meets my
criteria,
and I don't know how to.

I have properties (as a table), and I have property expenses (also as a
table)
I would like to display a report where for each property there is the
latest entry for electric bill, latest entry for gas bill, latest entry
for
service charge etc. i.e. the criteria is bill = electric, date = most
recent

I am at a loss as to how to go about the instruction for "most recent"
entry.


As ever, any help gratefully received.

Kind Regards,
Russell.

--
Message posted via http://www.accessmonster.com



  #3  
Old May 28th, 2010, 03:17 PM posted to microsoft.public.access.forms
Pascoe via AccessMonster.com
external usenet poster
 
Posts: 32
Default Picking only the latest entry?

Jeff,

Thanks for your reply.

We store the bills with one date on them, and it is that date that I will use
to monitor the "most recent" bill.

Kind Regards,
Russell.

Jeff Boyce wrote:
Russell

Access stores data in tables rather like a "bucket o' data" -- there is no
readily-apparent order.

For Access to give you "the latest entry" requires that you tell Access how
to determine what "latest" means.

I'm assuming you mean "most recent". If so, you'll need to tell Access
which (date/time) field to use to determine "most recent".

You mention "bills" on properties ... are you only interested in when the
bill came in, or also when it is/was due, when it was paid, etc...?

More info, please...

Regards

Jeff Boyce
Microsoft Access MVP

Hi Folks,

[quoted text clipped - 17 lines]
Kind Regards,
Russell.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201005/1

  #4  
Old June 1st, 2010, 07:47 PM posted to microsoft.public.access.forms
Pascoe via AccessMonster.com
external usenet poster
 
Posts: 32
Default Picking only the latest entry?

Bumping this back up!

Hoping for a reply!

Pascoe wrote:
Jeff,

Thanks for your reply.

We store the bills with one date on them, and it is that date that I will use
to monitor the "most recent" bill.

Kind Regards,
Russell.

Russell

[quoted text clipped - 22 lines]
Kind Regards,
Russell.


--
Message posted via http://www.accessmonster.com

  #5  
Old June 2nd, 2010, 12:13 AM posted to microsoft.public.access.forms
KenSheridan via AccessMonster.com
external usenet poster
 
Posts: 1,610
Default Picking only the latest entry?

You can restrict the query by means of a subquery which returns the latest
(MAX) date per property/bill, e.g.

SELECT Property, Bill, BillDate, Amount
FROM Properties INNER JOIN Expenses AS E1
ON Properties.PropertyID = E1.PropertyID
WHERE BillDate =
(SELECT MAX(Billdate)
FROM Expenses AS E2
WHERE E2.PropertyID = E1.PropertyID
AND E2.Bill =E1.Bill)
ORDER BY Property, Bill;

The two instances of the Expenses table are differentiated by the aliases E1
and E2, enabling the subquery to be correlated with the outer query.

Ken Sheridan
Stafford, England

Pascoe wrote:
Bumping this back up!

Hoping for a reply!

Jeff,

[quoted text clipped - 11 lines]
Kind Regards,
Russell.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201006/1

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.