Date Difference help needed

D

Dave Elliott

i have this code on my textbox417 on a sub-form
I want to find the difference between the current date and the max date of
BillDate
how many days have passed since the invoice was sent.
belwo code does not work
DateDiff("d",Date(),DMax("BillDate")
 
K

Klatuu

Your DMAX statement is not correct. I am assuming BillDate is a field in a
table. You need to supply the name of the table and depending on how
BillDate is used, you may need some criteria to limit the lookup. See DMAX
in Access Help for more info.

DateDiff("d",Date(),DMax("[BillDate]", "MyTableNameHere", "Critera = '" &
something & "'"))
 
D

Dave Elliott

ok, tried this, ad it gives the correct answer for just a flash and then
gives me #error

=IIf(Nz(DSum("BillAmt","TTimeBilling","TimeID=Forms!TimeCards!TimeID"),0)=Nz(DSum("Payment","TPaymentSub","TimeID=Forms!TimeCards!TimeID"),0),0,DateDiff("d",Date(),DMax("BillDate","TTimeBilling","TimeID=Forms!TimeCards!TimeID")))



Klatuu said:
Your DMAX statement is not correct. I am assuming BillDate is a field in
a
table. You need to supply the name of the table and depending on how
BillDate is used, you may need some criteria to limit the lookup. See
DMAX
in Access Help for more info.

DateDiff("d",Date(),DMax("[BillDate]", "MyTableNameHere", "Critera = '" &
something & "'"))

Dave Elliott said:
i have this code on my textbox417 on a sub-form
I want to find the difference between the current date and the max date
of
BillDate
how many days have passed since the invoice was sent.
belwo code does not work
DateDiff("d",Date(),DMax("BillDate")
 
Top