Solved Filter on emulated subform (1 Viewer)

Atthe

Member
Local time
Today, 06:12
Joined
Oct 26, 2021
Messages
57
Hi,

I have created a form which emulates a split form following the example database found here


Is there a way to implement filters?

I have tried

Code:
        [Forms]![Form]![SubForm].Form.filter = "[ToolType] = '" & Me.Combobox & "'"
        [Forms]![Form]![SubForm].Form.FilterOn = True

This filters as expected but allows the user to directly edit the subform when filtered which I dont want and also it doesn't return any values to the relevant textboxes when clicking on different records


Can anyone help?

Cheers
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:12
Joined
Oct 29, 2018
Messages
21,358
Maybe you can post a sample copy of your db?
 

Gasman

Enthusiastic Amateur
Local time
Today, 06:12
Joined
Sep 21, 2011
Messages
14,048
A filter is just that, a filter?
You could diable editing for the subform when filteron = True ?

I have used an ESF merely to select the correct record, which I edited in the mainform?
 

Atthe

Member
Local time
Today, 06:12
Joined
Oct 26, 2021
Messages
57
Please see attached sampleDB, notice that when a filter is selected on subjectID you can edit in the subform and also that the selected record fields do not get returned to their corresponding textboxes?

Any ideas

Cheers
 

Attachments

  • SampleDB1.accdb
    492 KB · Views: 361

mike60smart

Registered User.
Local time
Today, 06:12
Joined
Aug 6, 2017
Messages
1,899
Hi Not sure what you want to achieve here but in the attached I added a Clear button to remove the filter applied.
 

Attachments

  • SampleDB1.zip
    57.2 KB · Views: 335

Atthe

Member
Local time
Today, 06:12
Joined
Oct 26, 2021
Messages
57
A filter is just that, a filter?
You could diable editing for the subform when filteron = True ?

I have used an ESF merely to select the correct record, which I edited in the mainform?

Hi Not sure what you want to achieve here but in the attached I added a Clear button to remove the filter applied.
Thanks I hadn't added a clear button to the sample database. I am trying trying to achieve is a filter that will ONLY allow the user to edit via the main form textboxes not the subform (This works in the sample databbase until the filter is applied, once the subform has been filtered when you click on the filtered records they are not shown in the main form?)

Thanks
 

Gasman

Enthusiastic Amateur
Local time
Today, 06:12
Joined
Sep 21, 2011
Messages
14,048
Since this is an 'emulated' split form, you set the filter on the main form AND the subform?

Remember they are not linked by anything other than the same recordsource?

Here is how I applied a filter to mine.

Code:
Private Sub txtFilter_AfterUpdate()
Me.Filter = "Client Like ""*" & Me.txtFilter & "*"""
Me.FilterOn = True
Set Me.sfrmEmails.Form.Recordset = Me.Recordset
End Sub
 

Atthe

Member
Local time
Today, 06:12
Joined
Oct 26, 2021
Messages
57
Since this is an 'emulated' split form, you set the filter on the main form AND the subform?

Remember they are not linked by anything other than the same recordsource?

Here is how I applied a filter to mine.

Code:
Private Sub txtFilter_AfterUpdate()
Me.Filter = "Client Like ""*" & Me.txtFilter & "*"""
Me.FilterOn = True
Set Me.sfrmEmails.Form.Recordset = Me.Recordset
End Sub
Thankyou!

As suggested this worked for me

Code:
     Me.Filter = "SubjectID = '" & Me.Subject & "'"
                Me.FilterOn = True
                Set Me.fsubArchivedClasses.Form.Recordset = Me.Recordset
 

Gasman

Enthusiastic Amateur
Local time
Today, 06:12
Joined
Sep 21, 2011
Messages
14,048
Thankyou!

As suggested this worked for me

Code:
     Me.Filter = "SubjectID = '" & Me.Subject & "'"
                Me.FilterOn = True
                Set Me.fsubArchivedClasses.Form.Recordset = Me.Recordset
You need to do the same when you clear the filter as well.
 

Users who are viewing this thread

Top Bottom