O
Opal
I would like to use an Option group to sort records in a bound form,
but
am having difficulty getting it to work. I have used the function
before without an issue, but this time I cannot get it to work
as desired.
Using Access 2003, I have a form bound to my Concern table.
Within this form, I have a subform bound to my Countermeasure
table. Each record in the Concern table is related to a record
in the Countermeasure table. I want to be able to sort the
records by their Status as it appears in the Countermeasure table -
Specifically, Open, Closed or All records.
When I used this before, the sort option was in a bound
form with no subform. This time, however, I want to sort
by the subform and cannot get the records to sort. I get a
parameter pop up looking for the value of "Status". Below is the
code that I am using:
Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
If ApplyType = acShowAllRecords Then
Me.fraStatus.Value = 3 'Show all records
Me.fraStatus.Enabled = True
Else
Me.fraStatus.Value = Null 'No option button selected
Me.fraStatus.Enabled = False
End If
End Sub
Private Sub fraStatus_AfterUpdate()
If Me.fraStatus.Value = 2 Then
Me.Filter = "Status = 'Closed'"
Me.FilterOn = True
ElseIf Me.fraStatus.Value = 1 Then
Me.Filter = "Status = 'Open'"
Me.FilterOn = True
Else
Me.FilterOn = False
End If
End Sub
Is it possible to achieve the desired results?
but
am having difficulty getting it to work. I have used the function
before without an issue, but this time I cannot get it to work
as desired.
Using Access 2003, I have a form bound to my Concern table.
Within this form, I have a subform bound to my Countermeasure
table. Each record in the Concern table is related to a record
in the Countermeasure table. I want to be able to sort the
records by their Status as it appears in the Countermeasure table -
Specifically, Open, Closed or All records.
When I used this before, the sort option was in a bound
form with no subform. This time, however, I want to sort
by the subform and cannot get the records to sort. I get a
parameter pop up looking for the value of "Status". Below is the
code that I am using:
Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
If ApplyType = acShowAllRecords Then
Me.fraStatus.Value = 3 'Show all records
Me.fraStatus.Enabled = True
Else
Me.fraStatus.Value = Null 'No option button selected
Me.fraStatus.Enabled = False
End If
End Sub
Private Sub fraStatus_AfterUpdate()
If Me.fraStatus.Value = 2 Then
Me.Filter = "Status = 'Closed'"
Me.FilterOn = True
ElseIf Me.fraStatus.Value = 1 Then
Me.Filter = "Status = 'Open'"
Me.FilterOn = True
Else
Me.FilterOn = False
End If
End Sub
Is it possible to achieve the desired results?