Filter for a subform

L

Leslie Isaacs

Hello All

I am using Access2K.
I have a main form called [frm drbags] with a subform called [frm gp bags].
On the main form, above the subform, I have an option group called [Frame4],
which has two options, with data values 1 and 2 respectively. I have the
following AfterUpdate event for the option group:

Private Sub Frame4_AfterUpdate()
If [Frame4].Value = 1 Then
[frm gp bags].Filter = "[destroyed date]is null"
[frm gp bags].FilterOn = True
Else
[frm gp bags].FilterOn = False
End If
End Sub

.... which doesn't work!
I have tried various combinations, but to no avail - the syntax is eluding
me.
Hope someone can help.

Many thanks
Leslie Isaacs
 
A

Allen Browne

It is the form within the subform control that has the Filter property:

Private Sub Frame4_AfterUpdate()
If Me.[Frame4].Value = 1 Then
Me.[frm gp bags].Form.Filter = "[destroyed date] is null"
Me.[frm gp bags].Form.FilterOn = True
Else
Me.[frm gp bags].Form.FilterOn = False
End If
End Sub
 
L

Leslie Isaacs

Hello Allen

Many thanks for your help - the code worked a treat!

I haven't acknowledged your reply until now because I've been away.

Thanks again
Les.


Allen Browne said:
It is the form within the subform control that has the Filter property:

Private Sub Frame4_AfterUpdate()
If Me.[Frame4].Value = 1 Then
Me.[frm gp bags].Form.Filter = "[destroyed date] is null"
Me.[frm gp bags].Form.FilterOn = True
Else
Me.[frm gp bags].Form.FilterOn = False
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Leslie Isaacs said:
Hello All

I am using Access2K.
I have a main form called [frm drbags] with a subform called [frm gp
bags].
On the main form, above the subform, I have an option group called
[Frame4],
which has two options, with data values 1 and 2 respectively. I have the
following AfterUpdate event for the option group:

Private Sub Frame4_AfterUpdate()
If [Frame4].Value = 1 Then
[frm gp bags].Filter = "[destroyed date]is null"
[frm gp bags].FilterOn = True
Else
[frm gp bags].FilterOn = False
End If
End Sub

... which doesn't work!
I have tried various combinations, but to no avail - the syntax is eluding
me.
Hope someone can help.

Many thanks
Leslie Isaacs
 

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