A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How do I perform a date lookup and calculation in ACCESS



 
 
Thread Tools Display Modes
  #1  
Old October 4th, 2006, 12:25 PM posted to microsoft.public.access.queries
st0rm
external usenet poster
 
Posts: 1
Default How do I perform a date lookup and calculation in ACCESS

I have two tables:- table(A) contains a date and a numerical value which can
change at varying intervals (weeks, month etc.) Table(B) contains "date"
(daily information) and several numeriacl values.

I need to build an expression that will look at the date in table (A) and
use the numerical value to make a calculation from criteria in Table (B). I
would want the expression to continue making the calculation until it sees a
new date and value in table (A) then it would carry on making the calculation
using the new value until there is another change etc.

I think I need to perform a lookup but I am not sure how

Can anyone advise me of the right course of action for this?

Thanks
  #2  
Old October 4th, 2006, 05:38 PM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default How do I perform a date lookup and calculation in ACCESS

st0rm wrote:

I have two tables:- table(A) contains a date and a numerical value which can
change at varying intervals (weeks, month etc.) Table(B) contains "date"
(daily information) and several numeriacl values.

I need to build an expression that will look at the date in table (A) and
use the numerical value to make a calculation from criteria in Table (B). I
would want the expression to continue making the calculation until it sees a
new date and value in table (A) then it would carry on making the calculation
using the new value until there is another change etc.



I think this is what yo'r looking for:

SELECT B.*, (SELECT Top 1 A.numval
FROM tableA As A
WHERE A.datefield B.dailydate
ORDER BY A.datefield DESC
) As CurrentPrice
FROM tableB As B

--
Marsh
MVP [MS Access]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:28 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.