same filter code for 2 subforms in 1 mainform - only 1 work

  • Thread starter Thread starter danny
  • Start date Start date
D

danny

Dear ALL,

I've got the following problem for using an option group to filter data in 2
subforms which put together in one mainform.

The code is as follow:
-----------------------------
Private Sub Frame12_AfterUpdate()

Dim f1 As Form
Dim f2 As Form

Set f1 = Me.distribution_incoming.Form
Set f2 = Me.distribution_outgoing.Form

f1.Filter = "read = False"
f2.Filter = "read = False"

If Frame12.Value = 1 Then

f1.FilterOn = False
f2.FilterOn = False

ElseIf Frame12.Value = 2 Then

f1.FilterOn = True
f2.FilterOn = True

End If

End Sub
-----------------------------

The problem was that only f1 records were actually filtered when I picked
the option 2. Seems nothing happened to f2. However, by checking the FilterOn
staus of f2 in Immediate Windows I confirmed its status is FilterOn = True.

In the Immediate Window I put the following:

Forms!distribution_all_corr.distribution_outgoing.form.filteron = true

Then f2 records got filtered.

I don't know what's wrong with the code. Could you all experts please help?

Many Thanks!
Danny
 
Sorry please neglect the above one in order to avoid misunderstanding. Thanks!

I've got the following problem for using an option group to filter data in 2
subforms which put together in one mainform.

The code is as follow:
-----------------------------
Private Sub Frame12_AfterUpdate()

Dim f1 As Form
Dim f2 As Form

Set f1 = Me.distribution_incoming.Form
Set f2 = Me.distribution_outgoing.Form

f1.Filter = "read = False"
f2.Filter = "read = False"

If Frame12.Value = 1 Then

f1.FilterOn = False
f2.FilterOn = False

ElseIf Frame12.Value = 2 Then

f1.FilterOn = True
f2.FilterOn = True

End If

End Sub
-----------------------------

The problem was that only f1 records were actually filtered when I picked
the option 2. Seems nothing happened to f2. However, by checking the FilterOn
staus of f2 in Immediate Windows I confirmed its status is FilterOn = True.

I don't know what's wrong with the code. Could you all experts please help?

Many Thanks!
Danny
 
Back
Top