SQL to Check for update!

  • Thread starter Thread starter Greg
  • Start date Start date
G

Greg

HI all
I have DB that collects stcke quotes from a group of text files 200 + my
first version attempt was to read in 200 txt files and place in a
DailyPrices Table. this has worked okay until i go to update the tables
with new data, eg 3 or 5 days worth of stock prices.

The prices are imported to a temp table and then an update query is run
to clean some data and place it in the permanent table the data from the
temp table is then deleted

Can some give me some hints on how to implement a check routine to get
the last date that was in the permanent table so i can use it as a
filter for the temp table, therefore i only append the needed data.

this may involve doing sql by code and this is a new area for me
 
Greg said:
HI all
I have DB that collects stcke quotes from a group of text files 200 +
my first version attempt was to read in 200 txt files and place in a
DailyPrices Table. this has worked okay until i go to update the
tables with new data, eg 3 or 5 days worth of stock prices.

The prices are imported to a temp table and then an update query is
run to clean some data and place it in the permanent table the data
from the temp table is then deleted

Can some give me some hints on how to implement a check routine to get
the last date that was in the permanent table so i can use it as a
filter for the temp table, therefore i only append the needed data.

this may involve doing sql by code and this is a new area for me

You'd need to give details of your table structures for specific advice.
If all you want to know is what is the most recent date in a particular
field of the DailyPrices table, though, you can find that out without
any SQL at all. Just use the DMax() function. The most recent date is
also the maximum or highest-value date. So you could use code like
this:

Dim vLastDate As Variant

vLastDate = DMax("PriceDate", "DailyPrices")

Substitute the actual name of the date field for PriceDate, and the
actual name of the table for DailyPrices.
 
Back
Top