Grayed out Buttons in MS Access form

I have created two buttons on a form to search for particular records in the underlying table.
The first button to Filter By Form has On Click Event code of:

Private Sub FindRec_Click()
DoCmd.RunCommand acCmdFilterByForm
End Sub

This button works just fine.
The Apply Filter buton has On Click event code of:

Private Sub FindMyRec_Click()
DoCmd.RunCommand acCmdAdvancedFilterSort
End Sub

The problem is that when the first button is pressed, the form goes onto Filter By Form mode, as expected, but the button to apply the filter is now grayed out and cannot be used.
Why does the second button to apply the filter get grayed out, and more importantly how do I fix it?

Thanks in advance!

It appears to be working correctly. When you filter by form, it grays out other command buttons, sets the focus to first field in the list and displays the apply filter (the little funnel) on the menu bar. You get the same behavior if you click on the filter by form icon in the menu bar. Rather than create two new command buttons, you can use the inherent icons.

Oh, I forgot to mention (just before the board crashed) that you are invoking two different filter actions. The first is filter by form, with the follow on apply the filter. The second, advanced filter, brings up the query grid to select fields and criteria. HTH.

Thanks for the help BF.

The reason I’m not using the tolbar icons is that for security reasons, I set the database to only open the forms and not the Access window. As a result no toolbars or menus are displayed. This makes it necessary to place buttons on the form to perform these functions.

I’m wondering if placing the command buttons on a subform would help? I’ll try it and post the results.