Dates 2nd try

G

Guest

I thought I would try reposting this question to see if someone wanted to take a crack at it! TN

This is a two fold question

Let me set this up by saying this is a stock market database that I am creating. I have set up a table with the following fields. “Company, Date, Day high, Day low, close price, volume.â€

1. My first question is I am trying to develop a query that will take the close price minus the close price of the previous day and run a calculation. I could (and have tried) to do it up by simply using [date]-1. The problem is that markets are not open every day so I need to have it access the previous trading day listed in the database (Which will not necessarily be one calendar day back)

2. Is there any way to set up a query to only show dates that are a day of the week? i.e. If I wanted to only show entries that occurred on a Friday could it access the date field and only show that entries that are on a "Friday"

Anyone know of any links too access databases that have already been developed re: stocks

Thanks in advance for you're help! :
 
C

chris

This assumes that you have a complete set of stock prices
for each day they are available

Select max([DateField]) as MaxDate from MyTable; Query1
gives the most recent date
Select Max([DateField]) DMinus1 from MyTable Where
[DateField] <> DMax("[DateField]","MyTable"); Query2 gives
Date - 1


Select Company, ClosePrice from MyTable where [DateField]
= (Select MaxDate from Query1); All today's prices
Select Company, ClosePrice from MyTable where [DateField]
= (Select DMinus1 from Query2); All prev day's prices

-----Original Message-----
I thought I would try reposting this question to see if
someone wanted to take a crack at it! TNA
This is a two fold question.

Let me set this up by saying this is a stock market
database that I am creating. I have set up a table with
the following fields. â?oCompany, Date, Day high, Day low,
close price, volume.â?
1. My first question is I am trying to develop a query
that will take the close price minus the close price of
the previous day and run a calculation. I could (and have
tried) to do it up by simply using [date]-1. The problem
is that markets are not open every day so I need to have
it access the previous trading day listed in the database
(Which will not necessarily be one calendar day back).
2. Is there any way to set up a query to only show dates
that are a day of the week? i.e. If I wanted to only show
entries that occurred on a Friday could it access the date
field and only show that entries that are on a "Friday".
Anyone know of any links too access databases that have
already been developed re: stocks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top