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 » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Show latest Record



 
 
Thread Tools Display Modes
  #1  
Old October 20th, 2008, 06:43 AM posted to microsoft.public.access.queries
Daniel
external usenet poster
 
Posts: 1,017
Default Show latest Record

Hi Guys

I have a table wich relies on a master table. For example a Person table and
a table of a medical incident. A person can have multiple medical incidents.

What I want to do is show each persons latest medical incident. My medical
incident table has a mandatory date feild in it.

What do I need to use in mySQL to show this?
  #2  
Old October 20th, 2008, 07:42 AM posted to microsoft.public.access.queries
Allen Browne
external usenet poster
 
Posts: 11,706
Default Show latest Record

In the Control Source of a text box on your form, try an expression like
this:
=DMax("IncidentDate", "tblIncident", "PersonID = " & Nz([PersonID],0))

If you prefer, you can type this into the Field row in table design.

If you don't mind a read-only result, a subquery might be faster. See
Getting a related field from a GroupBy (total) query
at:
http://www.mvps.org/access/queries/qry0020.htm

Note that is is really important *not* to store this value in your table. It
must be calculated on the fly. Otherwise you are creating yourself a
maintenance nightmare, trying to cope with every possible combination of
inserting new records, deleting old ones, and modifying existing ones which
could affect the latest date. Having Access look up the date when you need
it is the only reliable, normalized approach.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Daniel" wrote in message
...
Hi Guys

I have a table wich relies on a master table. For example a Person table
and
a table of a medical incident. A person can have multiple medical
incidents.

What I want to do is show each persons latest medical incident. My medical
incident table has a mandatory date feild in it.

What do I need to use in mySQL to show this?


 




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 11:07 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.