-----original Message-----
Nick,
How you retrieve the date from the file on the disk depends on how you do
the import:
If the filename on the disk is always the same and the file is a linked
table in your database then things are simple; the criterion on the date
field in your Deelete query would be something like:
DFirst("[DateFieldName]","LinkedTableName")
If, on the other hand, you are doing a TransferText, then I can think of
three options:
(a) use code to read the date directly from the text file, so you can use it
in the criterion in the Delete query, or
(b) link the text file even if just for the purpose, so you can use the
DFirst like before, or
(c) do the import in a temporary table (delete everything in it before the
import), then use a DFirst on it for the Delete query, then use an Append
query to transfer the records from the temp table to the final one.
Note, all the above assumes there will ever only be one date's worth of data
on the disk.
In order to suppress warnings / confirmation on action queries (delete,
append, update, make table) in a macro, use a SetWarnings action with
argument False. If you need to restore warnings within the query (so, for
instance, for getting a warning on another action query that is run next)
use another SetWarnings with argument True.
HTH,
Nikos
Nikos,
There is a date field in the record and it would be great
if I could up date any date without checking it. As far
as the delete query it always ask if I want to continue.
1. How do I stop that? 2 How do you set up the read
statement? This sounds complicated. Please, Go step by
step. I am a little slow.
-----Original Message-----
Nick,
I suppose there is a date field in the records? Then a
quick and dirty way
to do it would be to:
1. Set-up a Delete query that deletes all records where
date = today
2. Set-up a simple macro that runs the delete query
first, then the Append
one
So you run the macro to update, and if there is already
data for the day it
is deleted first.
If there is no date field, you will need to add one.
It gets a little more complicated if you need to do
updates for a different
date, in which case you would need a way to "read" the
date form the new
record and pass it on to the delete query as a
parameter; not difficult,
just an extra step in setting it up.
HTH,
Nikos
I import data from a disk daily and sometimes I have to
import an updated version of information for the same
date in the afternoon. I currently delete the morning
data and import the afternoon updated version. Is there
away to import without duplicating the information or
have to go through the delete process.
.
.