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  

last entry per record query..



 
 
Thread Tools Display Modes
  #1  
Old December 10th, 2009, 03:18 AM posted to microsoft.public.access.queries
Sklyn
external usenet poster
 
Posts: 39
Default last entry per record query..

Hi and thanks for your time.

My database is tracking the service histroy of vehicles.
The main table has VIN as the PK which links to another table containing
details about each time the vehicle is serviced.

I need to make a query to then generate a report of when each vehicle was
LAST serviced. So my query would need to search each VIN and then only show
the most recent dated entry.

The main table is named "_VehicleDetails" and the related table is named
"ht_ServiceHistory"

I am fairly new to access so please try to keep it simple.
If I need to use code then please advise where the code needs to go also..
I'm hoping it can be done simply in design view

Thanks again
  #2  
Old December 10th, 2009, 08:34 AM posted to microsoft.public.access.queries
Allen Browne
external usenet poster
 
Posts: 11,706
Default last entry per record query..

1. In query design view, depress the Total button on the toolbar (big sigma
icon.) Access adds a Total row the the query design grid.

2. In the Total row under VIN, accept Group By.

3. In the Total row under your date field, choose Max.

This gives one record per serviced vehicle, with the latest date beside each
one.

If you want other fields from that record as well, it gets a bit more
complex. This might help:
http://www.mvps.org/access/queries/qry0020.htm

--
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.


"Sklyn" wrote in message
...
Hi and thanks for your time.

My database is tracking the service histroy of vehicles.
The main table has VIN as the PK which links to another table containing
details about each time the vehicle is serviced.

I need to make a query to then generate a report of when each vehicle was
LAST serviced. So my query would need to search each VIN and then only
show
the most recent dated entry.

The main table is named "_VehicleDetails" and the related table is named
"ht_ServiceHistory"

I am fairly new to access so please try to keep it simple.
If I need to use code then please advise where the code needs to go also..
I'm hoping it can be done simply in design view

Thanks again


  #3  
Old December 11th, 2009, 12:57 AM posted to microsoft.public.access.queries
Sklyn
external usenet poster
 
Posts: 39
Default last entry per record query..

Thanks so much Allen, I was hoping you would come to my aid
I had a look through your site as I always do but couldn't find what I was
after.
I used the Cascading Queries solution from the link you gave.

Any chance you can help me out with this problem too? Its to do with
highlighting/colouring a field when a different field meets criteria.
http://www.microsoft.com/office/comm...6-70e3b4cda6e4

Your help is much appreciated, People like you make learning a lot more
enjoyable.
Thanks very much.
James

"Allen Browne" wrote:

1. In query design view, depress the Total button on the toolbar (big sigma
icon.) Access adds a Total row the the query design grid.

2. In the Total row under VIN, accept Group By.

3. In the Total row under your date field, choose Max.

This gives one record per serviced vehicle, with the latest date beside each
one.

If you want other fields from that record as well, it gets a bit more
complex. This might help:
http://www.mvps.org/access/queries/qry0020.htm

--
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.


"Sklyn" wrote in message
...
Hi and thanks for your time.

My database is tracking the service histroy of vehicles.
The main table has VIN as the PK which links to another table containing
details about each time the vehicle is serviced.

I need to make a query to then generate a report of when each vehicle was
LAST serviced. So my query would need to search each VIN and then only
show
the most recent dated entry.

The main table is named "_VehicleDetails" and the related table is named
"ht_ServiceHistory"

I am fairly new to access so please try to keep it simple.
If I need to use code then please advise where the code needs to go also..
I'm hoping it can be done simply in design view

Thanks again


.

  #4  
Old December 11th, 2009, 09:47 AM posted to microsoft.public.access.queries
Allen Browne
external usenet poster
 
Posts: 11,706
Default last entry per record query..

Hopefully you'll get a reply to your thread.

Without reading it, there are several approaches, e.g. Conditional
Formatting, Format property of text box, or events in the form/report.

--
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.


"Sklyn" wrote in message
...
Thanks so much Allen, I was hoping you would come to my aid
I had a look through your site as I always do but couldn't find what I was
after.
I used the Cascading Queries solution from the link you gave.

Any chance you can help me out with this problem too? Its to do with
highlighting/colouring a field when a different field meets criteria.
http://www.microsoft.com/office/comm...6-70e3b4cda6e4

Your help is much appreciated, People like you make learning a lot more
enjoyable.
Thanks very much.
James

"Allen Browne" wrote:

1. In query design view, depress the Total button on the toolbar (big
sigma
icon.) Access adds a Total row the the query design grid.

2. In the Total row under VIN, accept Group By.

3. In the Total row under your date field, choose Max.

This gives one record per serviced vehicle, with the latest date beside
each
one.

If you want other fields from that record as well, it gets a bit more
complex. This might help:
http://www.mvps.org/access/queries/qry0020.htm

--
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.


"Sklyn" wrote in message
...
Hi and thanks for your time.

My database is tracking the service histroy of vehicles.
The main table has VIN as the PK which links to another table
containing
details about each time the vehicle is serviced.

I need to make a query to then generate a report of when each vehicle
was
LAST serviced. So my query would need to search each VIN and then only
show
the most recent dated entry.

The main table is named "_VehicleDetails" and the related table is
named
"ht_ServiceHistory"

I am fairly new to access so please try to keep it simple.
If I need to use code then please advise where the code needs to go
also..
I'm hoping it can be done simply in design view

Thanks again


.

 




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 03:50 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.