Update Field based on field in another table

l2evenge

New Member
Joined
Oct 20, 2014
Messages
28
I have one table that has repeating dates as below, though the HOLIDAY_KEY field is not fully populated yet(there are over 9000 records and not all of them are holidays). Each date will be represented continuously.

CAL_DATEDATAHOLIDAY_KEY
1/1/2011111
1/1/201110001
1/15/2011122
1/15/20118992

<tbody>
</tbody>

Then I have a table as below. Which only calls out the holiday dates themselves(as we are tagging them).

ACT_DATEHOLIDAY_KEY
1/1/20111
1/15/20112

<tbody>
</tbody>

Is there a way for me to update the holiday key in the first table automatically based on the dates in the second table?
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Should be a simple update query

Code:
 UPDATE Calendar INNER JOIN Hol_Day ON Calendar.CAL_DATE = Hol_Day.ACT_DATE SET Calendar.HOLIDAY_KEY = [Hol_Day].[HOLIDAY_KEY];

Replace Calendar(the one that has blank Holiday_Key and Hol_Day with your respective tables.)

Unless you mean update it every time you add a record in the first table - you automatically want the Holiday_Key to populate?
 
Last edited:
Upvote 0
Awesome! Took me a minute to figure out where to put the code. I am an Access newb.

Thank you so much Terry!
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,858
Members
449,052
Latest member
Fuddy_Duddy

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