Subforms filters vs. edit ON/OFF or Record Locks setting (1 Viewer)

dougcouch

Registered User.
Local time
Today, 04:42
Joined
Apr 14, 2014
Messages
12
Configuration: Main form (no data source), subform on tab control based on table, two subforms on first subform each Child/Master-linked to the primary key of the first subform's table.

The intention is for this tab's first subform and its subordinate subforms be "view only" (no adding, deleting, editing).

Earlier versions did not have these additional two subforms, at which point command buttons were created for a variety of filters (which worked fine). Once I placed the fields in these new subforms (which display as desired and follow the primary key navigation), these filters no longer worked.

Toying around with it, I discovered that if I turned the 3 editing related properties back on, the filters work again; however, I do not want editing available on this form.

Whether I turn off the edit-related properties or set Record Locks to All Records (both of which prevent editing), the filters cannot work.

Is there a solution and correct way to apply filters programmatically to this configuration while having editing of any kind unavailable?

Note: Each of these are simple filters filtering only the primary key of the first subform.

An example of the filter subs used currently:

Code:
'Filter button 1
Private Sub cmdFinancial_Ins_Click()
 On Error GoTo Err_cmdFinancial_Ins_Click
     Me.Filter = "[DocumentCategory] = 'FINANCIAL AND INSURANCE'"
    Me.FilterOn = True
    [labelStopFilteringDocs].ForeColor = vbRed
 Exit_cmdFinancial_Ins_Click:
    Exit Sub
 Err_cmdFinancial_Ins_Click:
    MsgBox Err.Description
    Resume Exit_cmdFinancial_Ins_Click
    
End Sub
Currently, all filters are turned off using a single Show All command button. (Later versions may incorporate filter toggle buttons for each one.)
 

dougcouch

Registered User.
Local time
Today, 04:42
Joined
Apr 14, 2014
Messages
12
Update to my question re subforms and filters:

I was able to achieve my goal in some early testing (since the question) by setting the filter and turning it on, for each of all three subforms on each of the 6 filter buttons' subs plus the Show All button sub. Just seems there might likely be a more elegant way to do this.
 

dougcouch

Registered User.
Local time
Today, 04:42
Joined
Apr 14, 2014
Messages
12
Unlike my simpler forms, although the extra code (mentioned last post reply) worked for filters, it didn't work to remove filters. Found a solution however, as a macro using RunCommand as RemoveFilterSort.
 

Users who are viewing this thread

Top Bottom