Filter subform by Allen Browne' codes but with additions (1 Viewer)

tihmir

Registered User.
Local time
Today, 01:43
Joined
May 1, 2018
Messages
257
Hi, all
I use that code http://allenbrowne.com/ser-62.html to filter my subform. It works great, but I want to make some additions:
1 - On Property Sheet I want to set "Navigation Buttons" to "No", because I want them hidden;
2 - I make custom buttons with text box to display the records with that code:
Code:
Private Sub Form_Current()
Me!txtResult = CurrentRecord & " to" & Me.RecordsetClone.RecordCount
Me.Caption = Me.txtResult
On Error Resume Next
' These If Statements manage the Navigation Buttons
  If Me.CurrentRecord = 1 Then
     Me.cmd_Back.Enabled = False
     Me.cmd_First.Enabled = False
  Else
     Me.cmd_Back.Enabled = True
     Me.cmd_First.Enabled = True
  End If
  If Me.CurrentRecord = Me.Recordset.RecordCount Then
      Me.cmd_Last.Enabled = False
  Else
     Me.cmd_Last.Enabled = True
  End If
  If Me.CurrentRecord >= Me.Recordset.RecordCount Then
     Me.cmd_Next.Enabled = False
  Else
     Me.cmd_Next.Enabled = True
  End If
End Sub
So, when the "Navigation Buttons" is set to "No" and filter with combobox the subform displays only 1 record, not all filtered records.
What should I do to show all filtered records in the subform?. Is it possible to do that with custom buttons and text box to display records?
 

June7

AWF VIP
Local time
Today, 00:43
Joined
Mar 9, 2014
Messages
5,466
Set subform for Continuous View.

Is main form bound to data? Is subform linked to main form data?
 

tihmir

Registered User.
Local time
Today, 01:43
Joined
May 1, 2018
Messages
257
Set subform for Continuous View.
Тhank you for the advice, June7. Now it works.
I have another similar problem with another filter form with combo box to filter into subform. The subform is not linked to main form.
On the Main form I have only unbounded combobox with the codes:
Code:
Sub SetFilter()
    Dim LSQL  As String
    LSQL = "select * from tbl_OtherАctivities"
    LSQL = LSQL & " where Inspector = '" & cbo_Inspector & "'"
    Form_fm_OtherАctivities.RecordSource = LSQL
End Sub
Code:
Private Sub cbo_Inspector_AfterUpdate()
    SetFilter
End Sub
Code:
Private Sub Form_Open(Cancel As Integer)
    SetFilter
End Sub

The subform Record Source is:
Code:
SELECT *
FROM tbl_OtherАctivities
WHERE (((tbl_OtherАctivities.[Inspector ])=''));
Still same problem. When I set the "Navigation Buttons" to "No" on the subform and choose from combobox on the Main form it display only 1 record on the subform. If the "Navigation Buttons" is set to "Yes" it display all filtered records on the subform
 

June7

AWF VIP
Local time
Today, 00:43
Joined
Mar 9, 2014
Messages
5,466
And this subform is also in Continuous View? I am surprised subform shows anything with that filter criteria. Setting of NavigationButtons property should have nothing to do with records display. At least it doesn't on my form. So I have no idea what is happening with yours.
 

tihmir

Registered User.
Local time
Today, 01:43
Joined
May 1, 2018
Messages
257
And this subform is also in Continuous View
No, I need this form to by Single.
Thank you for your help,June7. I will try to find out where my mistake is with the NavigationButtons property
 

Users who are viewing this thread

Top Bottom