Solved

problem with acCmdFilterByForm

Posted on 2008-06-12
8
607 Views
Last Modified: 2010-04-21
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?
0
Comment
Question by:Frank Freese
  • 4
  • 4
8 Comments
 
LVL 75
ID: 21770999
" Is there a way to do this where the command buttons are disabled?"

Not sure what you mean?  Which command buttons?

mx
0
 

Author Comment

by:Frank Freese
ID: 21771107
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.
0
 
LVL 75
ID: 21771320
"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?
0
 

Author Comment

by:Frank Freese
ID: 21771869
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

0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 500 total points
ID: 21772011
humm.  Well, there is nothing here that is disabling the buttons.  But my guess is the acCmdFilterByForm is doing this.  I've never used FBF ... but I think it 'grays' out buttons - and only allows entry in text boxes.  
That's just how it works.
So, you might try this:

Private Sub cmdSelectData_Click()
RunCommand acCmdFilterByForm
    Me.cmdClearSearch.Enabled = True
    Me.cmdLocateDate.Enabled = True
    Me.cmdSelectData.Enabled = True
End Sub




End Sub
0
 

Author Comment

by:Frank Freese
ID: 21772589
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!
0
 

Author Closing Comment

by:Frank Freese
ID: 31466606
many thanks!!!
0
 
LVL 75
ID: 21772633
ok
you are welcome.

mx
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now