Reputation: 531
The goal of the query at the bottom is to update the FullComplDate field if the below requirements are satisfied. I am not sure if it is an issue with the arrangement of the statements or parenthesis but I've tried changing the order of the statements and adding parenthesis but no luck.
BOTH of these statements are true:
AND either one of these two statements are true:
Instead, what is happening is that any record that satisfies that first three statements is being updated AND any record the satisfies just the 4th statement is being updated.
UPDATE tblSubscribers SET tblSubscribers.FullComplDate = Format(Date(),"mmmm" & " " & "yyyy")
WHERE (((tblSubscribers.FullComplDate) Is Null) AND ((tblSubscribers.SubscrComplDate) Is Not Null) AND (((tblSubscribers.CoverageLevel)="Employee Only")) OR (((tblSubscribers.CoverageLevel)="Employee + Child(ren)")));
Upvotes: 0
Views: 72
Reputation: 1320
I think the issues is with the parenthesis.... if you recude them and only have them wrapping the OR condition it should work better.
UPDATE tblSubscribers SET tblSubscribers.FullComplDate = Format(Date(),"mmmm" & " " & "yyyy")
WHERE tblSubscribers.FullComplDate Is Null
AND tblSubscribers.SubscrComplDate Is Not Null
AND (tblSubscribers.CoverageLevel="Employee Only" OR tblSubscribers.CoverageLevel ="Employee + Child(ren)")
You could try the IN Clause to avoid the OR
UPDATE tblSubscribers SET tblSubscribers.FullComplDate = Format(Date(),"mmmm" & " " & "yyyy")
WHERE tblSubscribers.FullComplDate Is Null
AND tblSubscribers.SubscrComplDate Is Not Null
AND tblSubscribers.CoverageLevel IN ("Employee Only" ,"Employee + Child(ren)")
Upvotes: 1
Reputation: 1647
The following should work (note brackets wrapping last AND/OR):
UPDATE tblSubscribers
SET tblSubscribers.FullComplDate = Format(Date(),"mmmm" & " " & "yyyy")
WHERE tblSubscribers.FullComplDate Is Null
AND tblSubscribers.SubscrComplDate Is Not Null
AND (tblSubscribers.CoverageLevel = "Employee Only"
OR tblSubscribers.CoverageLevel = "Employee + Child(ren)")
Upvotes: 0