Best method for updating records from a query?

  • Thread starter Thread starter Brian Beck
  • Start date Start date
B

Brian Beck

Here is what I want to do in a nutshell...All the records that are returned
from a particular query, I want to set a flag in each of those records to
true and also set the flag that was used to identify those records for the
query to false.

I've got various flags for records in a table to indicate whether a record
is ready to have a letter generated, whether a letter has been generated,
and whether a letter has been sent. Currently I'm using a query,
qSevere_Letter to grab all the records that have the flag
GenerateSevereLetter set to true. This query is used in conjunction with a
Microsoft Word template to generate letters for each record.

Once I've generated the letters, I'd like to be able to programmatically
have Access take each of the records in the query, set the flag
SevereLetterGeneratedFlag to true and also change the
GenerateSevereLetterFlag to false...this way I won't grab those records the
next time I generate letters.

Is this possible using macros or stored procedures, and if so, how would I
proceed?

-Brian
 
You just need a simple Update query

UPDATE
yourTableName
SET
GenerateSevereLetterFlag = False,
SevereLetterGeneratedFlag = True
WHERE
GenerateSevereLetterFlag=True

Cheers,
Jason Lepack
 

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

Back
Top