Update Query

R

Roger Bell

I have the following code in an update query:

UPDATE [MAIN TABLE] SET [MAIN TABLE].[WWC CARD REGISTERED1] = No, [MAIN
TABLE].[WWC CARD REGISTERED2] = No
WHERE ((([MAIN TABLE].[VALID TO1])<Now())) OR ((([MAIN TABLE].[VALID
TO2])<Now()));

The problem is that when this query is executed, it updates both fields to
NO, whether the Card has expired or not.

Is there a way around this?

I appreciate any help for a novice and Thanks
 
K

KARL DEWEY

Have you considered using IIF statement?
UPDATE [MAIN TABLE] SET ([MAIN TABLE].[WWC CARD REGISTERED1] = IIF([MAIN
TABLE].[VALID TO1]<Now(), No, [MAIN TABLE].[WWC CARD REGISTERED1])), ([MAIN
TABLE].[WWC CARD REGISTERED2] = IIF([MAIN TABLE].[VALID TO2]<Now(), No, [MAIN
TABLE].[WWC CARD REGISTERED2]));
 

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