Solved

problem with acCmdFilterByForm

Posted on 2008-06-12
8
620 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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
 
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

776 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