Link to home
Create AccountLog in
Avatar of Frank Freese
Frank FreeseFlag for United States of America

asked on

problem with acCmdFilterByForm

Folks,
I have 3 command buttons:
Select Data      RunCommand acCmdFilterByForm
Locate Data     RunCommand acCmdApplyFilterSort
Clear Search    RunCommand acCmdRemoveFilterSort

When I click on Select Data all command buttons are disabled. I would prefer to manage filtering with command buttons. Is there a way to do this where the command buttons are disabled?
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

" Is there a way to do this where the command buttons are disabled?"

Not sure what you mean?  Which command buttons?

mx
Avatar of Frank Freese

ASKER

When I click Select Data, which executes RunCommand acCmdFilterByForm, All command buttons on the form are disabled. To return the form to its orginal state I have to go to the toolbar and Apply Filter which reenables the forms command buttons. I would like to manage this in not using the toolbar.
"All command buttons on the form are disabled"

These are buttons you built, right?

You have code that is doing this, right ?

How does Apply Filter on the toolbar re-enable your command buttons?
Yes, Here is all the code. How does Apply Filter on the toolbar re-enable your command buttons? Good question. I do not even know why they're disabled.


Option Compare Database
Private Sub cmdClearSearch_Click()
RunCommand acCmdRemoveFilterSort
End Sub
 
Private Sub cmdLocateDate_Click()
RunCommand acCmdApplyFilterSort
End Sub
 
Private Sub cmdSelectData_Click()
RunCommand acCmdFilterByForm
End Sub
Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click
    DoCmd.Close acForm, "frmLocateManHourSheet"
    DoCmd.OpenForm "frmMainMenu"
 
Exit_cmdClose_Click:
    Exit Sub
 
Err_cmdClose_Click:
    MsgBox Err.Description
    Resume Exit_cmdClose_Click
    
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
thanks for looking into this with me. I have search the web and there are several comments similiar to this:
"While the "Filter-by-form" feature is enabled, the form is set up only to
allow for search criteria to be added, not to handle events, such as the
click of a button. Therefore, all controls that can't contribute to the
search criteria, such as buttons, list boxes, unbound text boxes, et
cetera, will be disabled. When the criteria selection has been chosen and the
filter applied with the built-in "Apply Filter" toolbar button (which looks like
a silver filter), the records that meet the search criteria will be
displayed in the form, and the buttons, list boxes, and unbound controls will
become enabled again.

http://www.tech-archive.net/Archive/Access/microsoft.public.access.forms/2005-10/msg00334.html "

Right now, I'll just have to stick with the Toolbar method.

Again, thanks!
many thanks!!!