Search in continuous form problem

Atthe

Member
Local time
Today, 22:43
Joined
Oct 26, 2021
Messages
57
Hi,

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


This works fine however when I am trying to implement a search function with the following code I get one match in the text box's but the continuous form does not filter to show if there are multiple matches (Ie it shows all records)

Code:
    Me.SearchItem.SetFocus
    Me.FilterOn = False
    Me.Filter = "[SearchItem] Like '*" & SearchItem & "*'"
    Me.FilterOn = True
    Me.Requery

Can anyone help?
 
have you tried it on Real Split form?
 
So you have to apply the same filter to the subform?, or perhaps just assign the form recordset again?
I am in a car park atm, but am sure I did this on one of my esf forms. Will check when I get home.
 
This is how I did it
Code:
Private Sub txtFilter_AfterUpdate()
Me.Filter = "Client Like ""*" & Me.txtFilter & "*"""
Me.FilterOn = True
Set Me.sfrmEmails.Form.Recordset = Me.Recordset
End Sub

and to clear
Code:
Private Sub cmdClearFilter_Click()
Me.Filter = ""
Me.txtFilter = ""
Me.FilterOn = False
Set Me.sfrmEmails.Form.Recordset = Me.Recordset
DoCmd.RunCommand acCmdRecordsGoToLast
DoCmd.GoToRecord acDataForm, Me.Name, acPrevious, 5 ' Needed for a continuous form as only last record shows.
DoCmd.RunCommand acCmdRecordsGoToLast

End Sub
The record movement is not needed for you most likely. I just wanted to see a few records in my subform.

HTH
 
Hi. If you need more help, you might consider posting a sample copy of your db. Just a thought...
 
This is how I did it
Code:
Private Sub txtFilter_AfterUpdate()
Me.Filter = "Client Like ""*" & Me.txtFilter & "*"""
Me.FilterOn = True
Set Me.sfrmEmails.Form.Recordset = Me.Recordset
End Sub

and to clear
Code:
Private Sub cmdClearFilter_Click()
Me.Filter = ""
Me.txtFilter = ""
Me.FilterOn = False
Set Me.sfrmEmails.Form.Recordset = Me.Recordset
DoCmd.RunCommand acCmdRecordsGoToLast
DoCmd.GoToRecord acDataForm, Me.Name, acPrevious, 5 ' Needed for a continuous form as only last record shows.
DoCmd.RunCommand acCmdRecordsGoToLast

End Sub
The record movement is not needed for you most likely. I just wanted to see a few records in my subform.

HTH

Thanks a lot this is perfect
 

Users who are viewing this thread

Back
Top Bottom