PC Review


Reply
Thread Tools Rate Thread

DMax expression

 
 
Jim L.
Guest
Posts: n/a
 
      16th Apr 2009
I am working on a vehicle maintenance database, and would like a report to
show each vehicle's most recent inspection date. I based the report on a
query, which has the following expression as a field;
Expr1: DMax("[Completion Date]","[Work Order]")
The problem is, it assigns the same "most recent inspection date" to all
vehicles, instead of extracting each vehicles inspection date.
How can I get the most recent date for each individual vehicle.
Another problem I ran into, is extracting just the inspections. In the
"Work Performed" field of the query, I have a criteria that says Like "Insp*"
(in case someone spells it wrong, or there was additional work performed).
When the query is run, some records are displayed where "Insp" is nowhere in
the "Work Performed" field. Why is this happening.
Thanks in advance for your help.
 
Reply With Quote
 
 
 
 
KC-Mass
Guest
Posts: n/a
 
      16th Apr 2009
Hi Jim,

You need an aggregate query ( select "Totals" under View). Group by
VehicleID and select "MAX" Completion date. That will give you the last
date each vehicle was worked on. Create a second query
with this query joined to the original table on "Completion Date" and get
whatever data from the original table for the last date something was done.

Regards

Kevin


"Jim L." <(E-Mail Removed)> wrote in message
news:E5ADFE7D-B23E-46F5-8096-(E-Mail Removed)...
>I am working on a vehicle maintenance database, and would like a report to
> show each vehicle's most recent inspection date. I based the report on a
> query, which has the following expression as a field;
> Expr1: DMax("[Completion Date]","[Work Order]")
> The problem is, it assigns the same "most recent inspection date" to all
> vehicles, instead of extracting each vehicles inspection date.
> How can I get the most recent date for each individual vehicle.
> Another problem I ran into, is extracting just the inspections. In the
> "Work Performed" field of the query, I have a criteria that says Like
> "Insp*"
> (in case someone spells it wrong, or there was additional work performed).
> When the query is run, some records are displayed where "Insp" is nowhere
> in
> the "Work Performed" field. Why is this happening.
> Thanks in advance for your help.



 
Reply With Quote
 
BruceM
Guest
Posts: n/a
 
      16th Apr 2009
Within the context of DMax you need to specify a Where condition. Assuming
there is a VehicleID field:
DMax("[Completion Date]","[Work Order]","[VehicleID] = " & [VehicleID])

Having said that, you are probably better off using the Totals query as
suggested in another post, although I'm not sure joining on CompletionDate
is the best choice. Rather, I would expect the join to be on VehicleID.
The details depend on the structure of your database.

"Jim L." <(E-Mail Removed)> wrote in message
news:E5ADFE7D-B23E-46F5-8096-(E-Mail Removed)...
>I am working on a vehicle maintenance database, and would like a report to
> show each vehicle's most recent inspection date. I based the report on a
> query, which has the following expression as a field;
> Expr1: DMax("[Completion Date]","[Work Order]")
> The problem is, it assigns the same "most recent inspection date" to all
> vehicles, instead of extracting each vehicles inspection date.
> How can I get the most recent date for each individual vehicle.
> Another problem I ran into, is extracting just the inspections. In the
> "Work Performed" field of the query, I have a criteria that says Like
> "Insp*"
> (in case someone spells it wrong, or there was additional work performed).
> When the query is run, some records are displayed where "Insp" is nowhere
> in
> the "Work Performed" field. Why is this happening.
> Thanks in advance for your help.



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for Dmax function in Expression Builder jrbor76 Microsoft Access 7 11th Sep 2009 03:10 PM
Dmin AND Dmax within expression builder scratchtrax Microsoft Access 15 12th May 2008 05:42 PM
DMax for dates in rpt group header returns DMax for entire records =?Utf-8?B?aGVsaW9z?= Microsoft Access Getting Started 1 19th Jul 2005 09:32 PM
Difficult DMax expression? Leslie Isaacs Microsoft Access Forms 2 6th Jul 2005 08:13 PM
Difficult DMax expression? Leslie Isaacs Microsoft Access Queries 2 6th Jul 2005 08:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:47 PM.