Help with a filter

iisjman07

Registered User.
Local time
Today, 14:45
Joined
Feb 21, 2011
Messages
10
Hi, I'm currently creating a database solution for a computer shop. Basically, I'm having issues with a filter I'm using so that a user can easily 'jump' to a certain record based on the ID (primary key). My issue is that I can enter an ID into the search field, press the 'Apply Filter' button, and it will jump to the correct job, but after pressing the 'Remove Filter' button which turns off the filter, trying to create a new filter fails. So it works once but not more.

The code running behind the buttons is:
Apply Filter
Code:
Private Sub Command78_Click()
        Me.Filter = "ID = Forms![Workshop_frm].[SearchBox].Value"
        Me.FilterOn = True
End Sub

Remove Filter:
Code:
Private Sub Command79_Click()
        Me.FilterOn = False
End Sub

I have attached a small version of the database as I realise this could be confusing... Any help would be greatly appreciated
 

Attachments

Aah, thanks for that. I added in a couple of 'Me.Refresh's which didn't fix everything, but I also added a couple of 'Me.Requery's which appears to have solved it. Thanks
 
Try this:
Code:
Private Sub Command78_Click()
[COLOR=Red]        Me.Filter = vbNullString[/COLOR]
        Me.Filter = "ID = Forms![Workshop_frm].[SearchBox].Value"
        Me.FilterOn = True
End Sub
 
Just a little note re Refresh and Requery - Refresh will update (or recalc) the current record whilst Requery will do so for the whole recordset. So you use one or the other where necessary.
 
Just a little note re Refresh and Requery - Refresh will update (or recalc) the current record whilst Requery will do so for the whole recordset. So you use one or the other where necessary.

Cool, good to know. Thanks Uncle Gizmo & vbaInet for the help
 

Users who are viewing this thread

Back
Top Bottom