DateAdd criteria

  • Thread starter Thread starter Anna
  • Start date Start date
A

Anna

Right now I'm trying to add a date using this function.

DateAdd("d", [lead time field populated with a number],
Date())

It tells me "data type mismatch" - can I not have a field
in the 2nd criteria? What else can I do then!?
 
Anna said:
Right now I'm trying to add a date using this function.

DateAdd("d", [lead time field populated with a number],
Date())

It tells me "data type mismatch" - can I not have a field
in the 2nd criteria? What else can I do then!?

Is it a text field? Convert it to a Integer data type:

DateAdd("d", CInt([lead time field populated with a number]), Date())
 
It is an integer field already.

But I tried using the function below and it tells
me "invalid use of Null"???

-----Original Message-----
Anna said:
Right now I'm trying to add a date using this function.

DateAdd("d", [lead time field populated with a number],
Date())

It tells me "data type mismatch" - can I not have a field
in the 2nd criteria? What else can I do then!?

Is it a text field? Convert it to a Integer data type:

DateAdd("d", CInt([lead time field populated with a number]), Date())

--
'-------------------------------
' John Mishefske
'-------------------------------

.
 
Anna said:
It is an integer field already.

But I tried using the function below and it tells
me "invalid use of Null"???

Is it possible that the field you are using contains a Null?

Try this:

DateAdd("d", Nz([yourField], 0), Date())

The Nz() function allows you to assign a default value (in the
second argument) when presented with a Null value in the first
argument.

This says that if the field you are using has a Null then don't
add any days to today's date. Don't know if that is what you
need - you need to decide how to handle Nulls.
 
Back
Top