Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flag Records From A Filtered Form

I have my Form set to filter to make sure that only clients who need to be mailed are loaded into this form.

[Complete]=No And [Call 1]="Wrong Number" Or [Complete]=No And [Call 2]="Wrong Number" Or [Complete]=No And [Call 3]="No Answer" or [Complete]=No And [Call 3]="Unavailable" or [Complete]=No And [Call 3]="Wrong Number"

I then have a mail merge done to print there letters and envelopes out. I have a field "Complete" set as a Yes/No defaulted to No. I would like to have a button that will flag all of these records filtered into this form to Yes for completed so after they do the mail merge we won't do them again.

My question is how do I flag only these records without doing the entire table?

Thanks in advance for any help in this matter.

like image 556
Chuck Avatar asked Nov 18 '25 17:11

Chuck


1 Answers

When an open form has an active filter the .RecordsetClone for that form returns the filtered recordset. So, your button to update the [Completed] flag could simply do something like this:

Private Sub btnUpdateCompleted_Click()
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
If Not (rst.BOF And rst.EOF) Then
    rst.MoveFirst
    Do While Not rst.EOF
        rst.Edit
        rst!Completed = True
        rst.Update
        rst.MoveNext
    Loop
End If
Set rst = Nothing
End Sub
like image 63
Gord Thompson Avatar answered Nov 21 '25 08:11

Gord Thompson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!