Microsoft Access and SQL - Update table.1 value when the record does not exist on table.2

TPS_Reports

New Member
Joined
Apr 24, 2014
Messages
16
I'm having some issues with getting the code below to work. When there is not a matching invoice on the Upload.Invoice table, I would like to update the Status field of the Unprocessed/Unapproved table to 2 when it is at 7 and the invoice field is not null.

I have tried the below SQL and it is not updating the values that fit the criteria. For my test there should be 4 updates and 0 are being completed. I usually use design view and am not sure where I went wrong in the code.

Code:
[FONT=Verdana]UPDATE [Table1], [Table2][/FONT][/FONT]
SET [Table1].Status = 2, [Table1].[Resolution Date] = Date()
WHERE (([Table1].Status)=7) AND (([Table1].Invoice) Is Not Null) AND (Not Exists (SELECT * FROM [Table1]
[FONT=Helvetica Neue][FONT=Verdana]              WHERE [Table1].Invoice = [Table2].Invoice));[/FONT][/FONT]
 
Last edited:

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,221,905
Messages
6,162,772
Members
451,786
Latest member
CALEB23

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