Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Jan 2005
    Wichita, Kansas, USA
    Thanked 0 Times in 0 Posts

    update query? (2000-SR1)

    I have a report that I print--it is based on a query "ProcessQuery" that brings up all records where the yes/no field "Processed" is "No"
    As soon as this report prints, I would like the table to be updated so that all of those previously unprocessed records(and unprinted) automatically get set to "Processed" by changing the yes/no field "Processed" value to "Yes".
    How does one do that?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 28 Times in 28 Posts

    Re: update query? (2000-SR1)

    Create an update query that sets Processed to Yes for all records with Processed = No.
    You can run this query (using DoCmd.OpenQuery or CurrentDb.Execute) from the On Close event of the report.

    Warning: Access doesn't distinguish between previewing and printing a report. You may want to ask the user for confirmation:
    Private Sub Report_Close()
    If MsgBox("Do you want to mark the records as Processed?", _
    vbYesNo + vbQuestion) = vbYes Then
    DoCmd.SetWarnings False
    DoCmd.OpenQuery "NameOfTheUpdateQuery"
    DoCmd.SetWarnings True
    End If
    End Sub
    Alternatively, you can open/print the report from a command button on a form. You can also run the update query from the On Click event procedure of the command button.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts