Radio Button as Filter

B

briank

Outside of my form (frmComments) I have created option buttons
(CommentFilter) that I would like to use as a filter within the form . . .
filtering on [Finished] which is a Yes/No property at the table level
(tblComments).
My radio button has three choices:
#1 for Finished = No
#2 for Finished = Yes
#3 for Finished = Both
However when I click on any of the three radio buttons I do not see any
filter
activity in the form. Any suggestions?

Private Sub CommentFilter_AfterUpdate()
Select Case Me!CommentFilter
Case 1
Me.Filter = frmComments![Finished] = 1
Me.FilterOn = True
MsgBox "Finished = No"
Case 2
Me.Filter = frmComments![Finished] = "No"
Me.FilterOn = True
MsgBox "Finished = Yes"
Case 3
Me.Filter = frmComments![Finished] = "3"
Me.FilterOn = False
MsgBox "Show All Records"
End Select
End Sub
 
M

Marshall Barton

briank said:
Outside of my form (frmComments) I have created option buttons
(CommentFilter) that I would like to use as a filter within the form . . .
filtering on [Finished] which is a Yes/No property at the table level
(tblComments).
My radio button has three choices:
#1 for Finished = No
#2 for Finished = Yes
#3 for Finished = Both
However when I click on any of the three radio buttons I do not see any
filter
activity in the form. Any suggestions?

Private Sub CommentFilter_AfterUpdate()
Select Case Me!CommentFilter
Case 1
Me.Filter = frmComments![Finished] = 1
Me.FilterOn = True
MsgBox "Finished = No"
Case 2
Me.Filter = frmComments![Finished] = "No"
Me.FilterOn = True
MsgBox "Finished = Yes"
Case 3
Me.Filter = frmComments![Finished] = "3"
Me.FilterOn = False
MsgBox "Show All Records"
End Select
End Sub


The filter property needs to be set to a string like:

Private Sub CommentFilter_AfterUpdate()
Select Case Me!CommentFilter
Case 1
Me.Filter = "Finished = False"
Me.FilterOn = True
MsgBox "Finished = No"
Case 2
Me.Filter ="Finished = True"
Me.FilterOn = True
MsgBox "Finished = Yes"
Case 3
Me.FilterOn = False
MsgBox "Show All Records"
End Select
End Sub
 
B

briank

Marshall Barton said:
briank said:
Outside of my form (frmComments) I have created option buttons
(CommentFilter) that I would like to use as a filter within the form . . .
filtering on [Finished] which is a Yes/No property at the table level
(tblComments).
My radio button has three choices:
#1 for Finished = No
#2 for Finished = Yes
#3 for Finished = Both
However when I click on any of the three radio buttons I do not see any
filter
activity in the form. Any suggestions?

Private Sub CommentFilter_AfterUpdate()
Select Case Me!CommentFilter
Case 1
Me.Filter = frmComments![Finished] = 1
Me.FilterOn = True
MsgBox "Finished = No"
Case 2
Me.Filter = frmComments![Finished] = "No"
Me.FilterOn = True
MsgBox "Finished = Yes"
Case 3
Me.Filter = frmComments![Finished] = "3"
Me.FilterOn = False
MsgBox "Show All Records"
End Select
End Sub


The filter property needs to be set to a string like:

Private Sub CommentFilter_AfterUpdate()
Select Case Me!CommentFilter
Case 1
Me.Filter = "Finished = False"
Me.FilterOn = True
MsgBox "Finished = No"
Case 2
Me.Filter ="Finished = True"
Me.FilterOn = True
MsgBox "Finished = Yes"
Case 3
Me.FilterOn = False
MsgBox "Show All Records"
End Select
End Sub
Marshall,
Your coding fix worked perfectly. TY.
 

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