Problem of dateAdd() function

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

Amy Blankenship

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)?
 
K

KARL DEWEY

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]));
 

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