Filter Subform with code

G

Guest

Currently I have the following code on the 1st tab of a tabbed form behind a
button to filter the records:

Private Sub OpenAlerts_Click()
Me.Refresh
DoCmd.ApplyFilter , "[ALERT ACTIVE (Y/N)]=Yes"
End Sub

The Active Alert checkbox data reference above is stored in the parent table.

On the 2nd tab of this tabbed form I have a subform which is linked by ID to
a second (child) table

I need to create a second command button to sort for Active Alerts (from
parent table) and a null Implement Dates (from linked table 2nd table).

What is the required code to add so that I can sort for Active alerts (per
above code) AND an ImplementDate field that is null?

Thank You
 
P

Pieter Wijnen

First of all use
Me.Filter = "[ALERT ACTIVE (Y/N)]<> 0"
Me.FilterOn = True
Instead of The DoCmd

then expand with
Me.Filter = "[ALERT ACTIVE (Y/N)]<> 0 And ImplementDate Is Null"

HtH

Pieter
 

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

Top