DMax and DMin Code Help Needed

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

On my form there is a control named Work Date. This form has record
selectors and uses the same date field , i.e. Work Date for each record.
I am trying to calculate the difference between the same control only the
number of days between the Max and Min Date., i.e. Oldest Date & Newest
Date, NOT Date()
The textbox that I want to show this is named Text98, also if there is no
date difference, it should show 0.
Tried the below, it didnt work. Hours is the table name.
Thanks,
Dave

=DMax("Work Date", "Hours") - DMin("Work Date", "Hours")
 
Dave said:
On my form there is a control named Work Date. This form has record
selectors and uses the same date field , i.e. Work Date for each record.
I am trying to calculate the difference between the same control only the
number of days between the Max and Min Date., i.e. Oldest Date & Newest
Date, NOT Date()
The textbox that I want to show this is named Text98, also if there is no
date difference, it should show 0.
Tried the below, it didnt work. Hours is the table name.
Thanks,
Dave

=DMax("Work Date", "Hours") - DMin("Work Date", "Hours")

Exactly what results do you expect when you subtract a date from a date and
what results are you getting?

You likely should be using the DateDiff() function.
 
I dont understand how to do the syntax?
Need to subtract Work Date from Work Date with a latest and oldest date
difference in days, i.e. Number of days difference between
Greatest date and least date!!!
 
Hi Dave

I don't have the other threads of this response, however, I think that what you
are looking for is as follows:

=DateDiff("d", Max([Work Date]), Min([Work Date])

Hope this helps

Maurice St-Cyr
Micro Systems Consultants, Inc
 
Back
Top