Filtering out records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a form on which are several tabbed subforms. The form is for the
purpose of inputting information about jobs that come into our department,
and tracking the progress of work on them. Each job has a job number, and
jub numbering starts at "1" at the beginning of each day.

Presently I have a filter in the OnLoad event of the form so that jobs with
the "Completed" checkbox checked do not show. (Form Filter property is
[JobCompleted] = 0, and code in the OnLoad event is Me.FilterOn = True)

I would now like to have completed jobs get hidden as soon as the
"Completed" box is clicked (checked). How do I code the OnClick event of the
"Completed" checkbox to accomplish this?

Thanks!
Rosemary
 
To remove the record form the form straightaway, you need to save the record
and requery the form:

Private Sub Completed_AfterUpdate()
If Me.Completed.Value Then
Me.Dirty = False 'save the change.
Me.Requery 'reload the form.
End If
End Sub

Note that the requery will throw you back to the first record in the form,
which could be confusing. If you don't like that, you will need to save the
primary key of the next or previous record, and then FindFirst in the form's
RecordsetClone after the Requery.
 
Back
Top