Will this work?

g0009348

New Member
Joined
Sep 8, 2015
Messages
11
Could you please advise if this will work? I;m not sure a And and OR is correct?

WHERE (((pt_tbl.SS_Status)=False) AND ((PartInformation.PendingObsolescenceDate)<>#31/12/9999#)) OR ((D20_EFF_IN_Y)=(servicereleasedate));

Thanks
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
What, in words, criteria do you want to apply?

As it is it looks like it's this, return records where either,

pt_tbl.SS_Status =False AND PendingObsolescenceDate<>#31/12/9999#

is true, or,

D20_EFF_IN_Y=servicereleasedate

is true.

Is that what you want?
 
Upvote 0
UPDATE pt_tbl INNER JOIN PartInformation ON pt_tbl.WERS = PartInformation.EngineeringPartNumber SET pt_tbl.SS_Status = True
WHERE (((pt_tbl.SS_Status)=False) AND ((PartInformation.PendingObsolescenceDate)<>#31/12/9999#)) OR ((D20_EFF_IN_Y)=(servicereleasedate));

Hi, This is the full statement.

I need it to set the SS_Status to true, but only where the ss status is already false and PartInformation.PendingObsolescenceDate is not equal to 31/12/9999 or the D20_EFF_IN_Y date matches the servicereleasedate
 
Upvote 0
Is this what you mean?

Update records where,

pt_tbl.SS_Status =False

AND

PendingObsolescenceDate<>#31/12/9999# Or

D20_EFF_IN_Y=servicereleasedate
 
Upvote 0
yes, exactly that, however I've tried the code but it didnt update any parts affected by the OR D20_EFF_IN_Y=servicereleasedate

 
Upvote 0
Does this work?

UPDATE pt_tbl INNER JOIN PartInformation ON pt_tbl.WERS = PartInformation.EngineeringPartNumber SET pt_tbl.SS_Status = True
WHERE pt_tbl.SS_Status=False AND (PartInformation.PendingObsolescenceDate<>#31/12/9999# OR D20_EFF_IN_Y=servicereleasedate);
 
Upvote 0
No, still returns the same result as if the OR D20_EFF_IN_Y=servicereleasedate) statement wasnt there. It is dates in both these colums, would that make any difference?
 
Upvote 0
If any of these are table/field references,
Code:
D20_EFF_IN_Y=servicereleasedate
I would try adding the table name same as is done elsewhere: pt_tbl.SS_Status
The fact that the table isn't referenced leads me to think this is a sql statement in code, as I suspect Access would otherwise automatically include it.
So, as long as there are dates in D20_EFF_IN_Y that equals what looks like a variable reference, it should work - provided that servicereleasedate is formatted properly.
If it is a variable that equals (for example) 21/05/2015, it will not work if you have not included the date delimiters. How you'd solve this depends on whether or not this is sql being executed in vba or a query.
 
Upvote 0

Forum statistics

Threads
1,221,831
Messages
6,162,248
Members
451,756
Latest member
tommyw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top