Simple Update Q Problem

G

Guest

I am trying to find the following information:

Update the TestField to be CALLED_ON if:
1) CALLED_ON is >= 270 days ago
2) DNC is set to False
3) CALL_RESULTS <> "Bad Number
4) CALL_RESULTS <> "PFS"
5) CALL_RESULTS <> "Add to DNC"

Here is my code:

UPDATE tblCandidates SET tblCandidates.TestField = [Called_On]
WHERE (((tblCandidates.DNC)=False) AND ((tblCandidates.CALL_RESULTS)<>"Bad
Number" And (tblCandidates.CALL_RESULTS)<>"PFS" And
(tblCandidates.CALL_RESULTS)<>"Add to DNC") AND ((Date()-[CALLED_ON])>=270));

Any thoughts?

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/com...0168f5515c&dg=microsoft.public.access.queries
 
M

MGFoster

Rod said:
I am trying to find the following information:

Update the TestField to be CALLED_ON if:
1) CALLED_ON is >= 270 days ago
2) DNC is set to False
3) CALL_RESULTS <> "Bad Number
4) CALL_RESULTS <> "PFS"
5) CALL_RESULTS <> "Add to DNC"

Here is my code:

UPDATE tblCandidates SET tblCandidates.TestField = [Called_On]
WHERE (((tblCandidates.DNC)=False) AND ((tblCandidates.CALL_RESULTS)<>"Bad
Number" And (tblCandidates.CALL_RESULTS)<>"PFS" And
(tblCandidates.CALL_RESULTS)<>"Add to DNC") AND ((Date()-[CALLED_ON])>=270));

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Use the IN () predicate:

UPDATE tblCandidates
SET TestField = Called_On
WHERE DNC = False
AND CALL_RESULTS NOT IN ("Bad Number", "PFS", "Add to DNC")
AND (Date()-CALLED_ON) >= 270

Since the value of CALL_RESULTS can only be one value, you'd have to use
a string of OR expressions in parentheses, or the IN () predicate, which
is a shortened version of the string of ORs. E.g.:

WHERE (call_results <> "Bad Number" OR call_results <> "PFS" OR
call_results <> "Add to DNC")
AND DNC = FALSE
AND (Date() - called_on) >= 270

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBRKq3pIechKqOuFEgEQKkFwCfZFbEwVArQrklCPfc+UBYMs7JMYIAn0fY
C52NOWqM0ryzH9AOjAURqPTO
=oCX7
-----END PGP SIGNATURE-----
 

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