Refresh SubForm (1 Viewer)

VzqCrs

Member
Local time
Today, 00:07
Joined
Nov 15, 2021
Messages
54
HI All,

I have a main form (frmIncRetEstimates) with three combo boxes and a SubForm sfrmEstimateLogSummary) that opens in Datasheet view and is linked by the Link Master Field and its Link Child Field

The SubForm when opened on its own has a filter and the Filter On Load is set to Yes.

I created the Main form and dragged the subform and linked each of the combo boxes to their respective field. There's a couple of things going on, all related to the filtering.
1. When I open the main form, the subform doesn't display any information.
2. When I click the combo box that has a value list on it, the table filters itself (Station or LIne)
3. When I click the combo box that has a query in the rowsource, although I can make a selection, the subform won't filter until I make a selection on the combo with the value list
3. The third button will populate the combo box but won't allow me to actually make the selection.

I have two other buttons to re-filter:
Reset button should display the subform filtered on the current user only
Show All button should remove all filters and show all records

Code:
Private Sub cmdReset_Click()
    Dim ctl As Control
    For Each ctl In Me.Section(acHeader).Controls
    If ctl.Name Like "cbo&" Then
        Select Case ctl.ControlType
        Case acTextBox, acComboBox
            ctl.Value = Null
        Case acCheckBox
            ctl.Value = False
        End Select
        End If
    Next ctl
    Me.sfrmEstimateLog.Form.Filter = "[Requestbyperson] = '" & ResolveCurrentUserName & "'"
    Me.sfrmEstimateLog.Form.FilterOn = True
End Sub

Code:
Private Sub cmdShowAll_Click()
Me.sfrmEstimateLog.Form.FilterOn = False
Me.sfrmEstimateLog.Form.Filter = ""
End Sub

I've attached my database for reference

1643217004952.png
 

Attachments

  • RequestsDatabase.zip
    1 MB · Views: 226

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 23:07
Joined
Feb 28, 2001
Messages
23,117
1. When I open the main form, the subform doesn't display any information.
If the sub-form has a parent/child relationship with the main form, and there are fields that synchronize this relationship.


Then, if you STILL don't get any info, it may be because there isn't any that matches up. Sync should be automatic such that a "navigate" of the main should ripple down to the sub. If it doesn't, then I'm not sure. I can't look at your DB at the moment because of schedule issues. (Mine, not yours.)
 

VzqCrs

Member
Local time
Today, 00:07
Joined
Nov 15, 2021
Messages
54
I have ensured that the Master and Child links are correct.
In my subform I removed all events and filters and the form, on its own loads all records.

but it won't let me filter both
 

Attachments

  • image001 (4).png
    image001 (4).png
    25.7 KB · Views: 198
  • image001 (5).png
    image001 (5).png
    31.8 KB · Views: 199

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 23:07
Joined
Feb 28, 2001
Messages
23,117
I finally got back to this. I discovered that I have an older version of Access than was used to create that file, and therefore I cannot open your file. Other members of the forum will have to do any examination.
 

GPGeorge

Grover Park George
Local time
Yesterday, 21:07
Joined
Nov 25, 2004
Messages
764
When I try to select a value in the "third" combo box with the label "Select by Requester", an error is raised.
1643302613653.png
 

VzqCrs

Member
Local time
Today, 00:07
Joined
Nov 15, 2021
Messages
54
there's no code behind that right now but ideally that's the third filter and it should be able to filter with any of these selected
 

Minty

AWF VIP
Local time
Today, 05:07
Joined
Jul 26, 2013
Messages
9,363
A search combo shouldn't be bound to a table, simply gather data from it as an unbound control, I think that is what @GPGeorge was alluding to?
 

VzqCrs

Member
Local time
Today, 00:07
Joined
Nov 15, 2021
Messages
54
Firstly, thank you for taking a look!
I removed that from the control so now that filter holds the selection, but until I select something in Station or Line dropdown nothing filters.

The Reset and Show all don't clear the combo selections
 

Attachments

  • RequestsDatabase (1).zip
    1 MB · Views: 214

Users who are viewing this thread

Top Bottom