Ian,
Locking a record after a report has printed can be an "iffy" proposition, since Preview
and Print essentially trigger the same events. So, for instance, if you used the report
Close event to determine that the report has "printed"... Print Preview (without actually
"printing") will fire the same code.
So...logically there's not any real difference between putting the checkbox update in
the OpenReport event, or the Report Close event... either logic is a bit shaky.
Place this code in the Close event of the report... (use your own object names)
Private Sub Report_Close()
Forms!YourFormName!chkPrinted = True
Forms!YourFormName.Form.AllowEdits = False
Forms!YourFormName.Form.AllowDeletions = False
Forms!YourFormName.Form.Refresh
End sub
But, you will also need to determine the Lock status when browsing from record to record,
so place this code in the OnCurrent event of the Form...
Private Sub Form_Current()
If chkPrinted = True Then
Me.AllowEdits = No
Me.AllowDeletions = No
Else
Me.AllowEdits = Yes
Me.AllowDeletions = Yes
End If
End Sub
OR... in a shorter method
Private Sub Form_Current()
Me.AllowEdits = Not chkPrinted
Me.AllowDeletions = Not chkPrinted
End Sub
Note: You'll probably need some method to Override the Lock. Otherwise the Lock can only
be removed via the table.
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions
"Find a job that you love, and you'll never work a day in your life."