Update query based on dates

Texas Longhorn

Active Member
Joined
Sep 30, 2003
Messages
493
Hi all,

I'm new to Access and I am trying to do an update query that i could use some help with. I have two tables: [HLT Data] and [CStat Data]. In [HLT Data], I am trying to update the field Debt to be the [CStat Data].[DebtMM] value where two conditions are met: (1) The unique company identifier in each table matches, and (2) [CStat Data].DataDate is the largest date that is less than or equal to [HLT Data].NewDate.

What I've done is started an Update Query where I have linked the unique company identifier between the two tables. However, I'm not sure how to deal with the date criterion. The [HLT Data] table has monthly fields, whereas [CStat Data] is quarterly. I'm trying to associate the correct quarterly datapoint from [CStat Data] with each monthly date in [HLT Data]. As an example:

Code:
[HLT Data].NewDate          [CStat Data].DataDate         [CStat Data].DebtMM
6/30/96                           4/17/96                             50
7/31/96                           7/19/96                             60
8/31/96                           7/19/96                             60
9/30/96                           7/19/96                             60
10/31/96                         10/16/96                            55
Here's what I've done, which has nothing to address the date issue:

Code:
UPDATE [HLT Data] INNER JOIN [CStat Data] ON [HLT Data].PERMNOLink = 
[CStat Data].NPERMNO SET [HLT Data].Debt = [CStat Data].DebtMM;

Any tips would be greatly appreciated.

Thanks,
Bill
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,212,932
Messages
6,110,748
Members
448,295
Latest member
Uzair Tahir Khan

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