DMax and DMin Code Help Needed

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")
 
R

Rick Brandt

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

Dave

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!!!
 
S

StCyrM

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top