Hello everyone,
I'm trying to use an option group to filter a subform from my main form.
I did try some scrips behind the option group Afterupdate event but i'm not able to make it work and actually filter the information shown in the subform.
I managed in the end to kind obtain what i was looking for but is not very elegant and needs one extra step from the user.
More exactly i put the following code behind the afterupdate event :
This inserts a value in a hidden textbox (called "txtFilter").
After i have a button near the option group with the following code behind the click event :
* [Comment] is the field in the subform that i want to filter
Although I tried to have the above code directly to the textbox events, none of the evnts seem to run the code ( afterupdate , on chnage, on dirty,on enter ). and the only way it works is by having the seperate button described above.
Could you please help me with a solution to filter the subform (T_all_sub, found in the main form T_all) directly from the option group or at least form the textbox without the need of a separate button.
Thank you everyone for your answers and help.
Regards,
I'm trying to use an option group to filter a subform from my main form.
I did try some scrips behind the option group Afterupdate event but i'm not able to make it work and actually filter the information shown in the subform.
I managed in the end to kind obtain what i was looking for but is not very elegant and needs one extra step from the user.
More exactly i put the following code behind the afterupdate event :
Code:
If Me.Frame100 = 1 Then Me.txtFilter = "1"
If Me.Frame100 = 2 Then Me.txtFilter = "2"
After i have a button near the option group with the following code behind the click event :
Code:
Dim strFilter As String
strFilter = "Comment = '" & Me.txtFilter & "'"
Forms!T_all!T_all_sub.Form.Filter = strFilter
Forms!T_all!T_all_sub.Form.FilterOn = True
Although I tried to have the above code directly to the textbox events, none of the evnts seem to run the code ( afterupdate , on chnage, on dirty,on enter ). and the only way it works is by having the seperate button described above.
Could you please help me with a solution to filter the subform (T_all_sub, found in the main form T_all) directly from the option group or at least form the textbox without the need of a separate button.
Thank you everyone for your answers and help.
Regards,