Problem of dateAdd() function

  • Thread starter Thread starter Luting
  • Start date Start date
L

Luting

Hi all,

I have an error when using the function dateAdd(). Here is my sql
statement:
SELECT FLINK_N_OPERLOG.*
FROM YQPW, FLINK_N_OPERLOG
WHERE (((FLINK_N_OPERLOG.TMSTAMP)>=" [Forms]![YQPW]![BEGIN]" And
(FLINK_N_OPERLOG.TMSTAMP)<=DateAdd("n","20",[Forms]![YQPW]![BEGIN])));

The error says:
This expression is typed incorrectly, or it is too complex to be
evaluated.

How can I fix it?
Is DateAdd("n", "20", sth.)=sth.+20(min)?

Thanks in advance.
 
Luting said:
Hi all,

I have an error when using the function dateAdd(). Here is my sql
statement:
SELECT FLINK_N_OPERLOG.*
FROM YQPW, FLINK_N_OPERLOG
WHERE (((FLINK_N_OPERLOG.TMSTAMP)>=" [Forms]![YQPW]![BEGIN]" And
(FLINK_N_OPERLOG.TMSTAMP)<=DateAdd("n","20",[Forms]![YQPW]![BEGIN])));

The error says:
This expression is typed incorrectly, or it is too complex to be
evaluated.

How can I fix it?
Is DateAdd("n", "20", sth.)=sth.+20(min)?

Is it possible that the problem is actually with FLINK_N_OPERLOG.TMSTAMP)>="
[Forms]![YQPW]![BEGIN]", which seems to be comparing a date field with a
string value (note the quotes)?
 
Remove some quotes as you want to add 20, a number and not text characters.

Try this, changing your text entry to date --
SELECT FLINK_N_OPERLOG.*
FROM YQPW, FLINK_N_OPERLOG
WHERE [FLINK_N_OPERLOG].[TMSTAMP]>= CVDate([Forms]![YQPW]![BEGIN]) And
[FLINK_N_OPERLOG].[TMSTAMP]<=DateAdd("n",20,CVDate([Forms]![YQPW]![BEGIN]));
 
Back
Top