Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Filtering By Selection

Posted on 2000-04-18
11
Medium Priority
?
230 Views
Last Modified: 2012-08-14
On my form I would like to make it when you click on a on click event it goes into "Filter By Form"

Also on this I notice that it gets rid of the headers and footers is there a way so that they stay visible because I would ideally like to put some buttons there.
Thankyou
0
Comment
Question by:michaeldi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
11 Comments
 
LVL 1

Author Comment

by:michaeldi
ID: 2725900
Adjusted points from 30 to 70
0
 
LVL 10

Expert Comment

by:paasky
ID: 2727733
Hello michaeldi,

Would you please give us more details.

Regards,
Paasky
0
 
LVL 1

Author Comment

by:michaeldi
ID: 2728593
2Well basiclly you know all the button on the toolbar,(ie the ones to do with Filter)

I just want to make up a command button so that when you press it, it does the same as it does as if you would have pressed it on the toolbar.

I am looking for the code to so when I click a button ie in my form footer it goes into "Filter By Form" mode

"Filter By Form" mode ie the mode that gives you the chance to use OR statements etc.

I basiclly need this to make my MDB more user friendly.
Can you or anybody paste me the code that would do this.

All of the other filter commands I found in the wizrds but not this one..

Thakyou in advance



0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:paasky
ID: 2728620
Thanks for details, here's the button code:

Private Sub B_FilterByForm_Click()
    DoCmd.RunCommand acCmdFilterByForm
End Sub

Please let me know if this does not give you the desired result.

Paasky
0
 
LVL 10

Expert Comment

by:paasky
ID: 2728625
Here are the two other filtering button DoCmd.RunCommand commands:

DoCmd.RunCommand acCmdFilterBySelection
DoCmd.RunCommand acCmdFilterExcludingSelection

Paasky
0
 
LVL 10

Expert Comment

by:paasky
ID: 2728649
This will apply the filter:

DoCmd.RunCommand acCmdApplyFilterSort

There seems to be no way to avoid buttons been disabled when the filter mode is on - MS has build it to work that way.
0
 
LVL 1

Author Comment

by:michaeldi
ID: 2730066
You can have the points. I have two quick Questions.

Are you positive that you can not get it to see any buttons in that filterForm mode or shall i post it as another Question.

And just quickly is there a cmd command to load up the preloaded queries ie so when you click on :-

Private Sub B_FilterByForm_Click()
    DoCmd.RunCommand acCmdFilterByForm. load.the.the.pre.saved.queries.dialog.box.for.for.filter.

End Sub
in loads up the queries.
Thanks for all your help

0
 
LVL 10

Accepted Solution

by:
paasky earned 280 total points
ID: 2730151
I had some buttons in my test form header and footer, and when I pressed FilterByForm button, all buttons (including those which were in detail section) were disabled in FilterByForm mode - but they didn't disappear. If you like, I can ask second opinion from other expert about this issue - and of course you can do that yourself if you want more opinions.

BTW, just curious, what button actions you want to be enabled during the time the form is in filter mode? Is it bad that buttons are disabled?

You can have only one parameter with DoCmd.RunCommand function: the action (you can see the full list of action constants looking for Access help using keywords "RunCommand Method Constants".

Here's a link you find very useful information about RunCommand actions:

http://home.clara.net/tkwickenden/

As requested, here's the code which sets form to filter mode and opens the query dialog:

Private Sub B_FilterByForm_Click()
   
    ' handle possible error messages
    ' for eg. user press 'Cancel' button
    ' instead of choosing any query

    On error resume next

    ' Enter filter by form mode
    DoCmd.RunCommand acCmdFilterByForm

    ' Show available queries
    DoCmd.RunCommand acCmdLoadFromQuery

End Sub

Hope this helps,
paasky
0
 
LVL 10

Expert Comment

by:paasky
ID: 2730176
One work-around solution for button-problem could be customized toolbar form, where you have all the buttons you want to be used with forms. To filter the particular form, you need to set focus to that form and then use DoCmd.RunCommand:

This code is from own toolbar form:

Private Sub B_FilterByForm_Click()


    On error resume next

    ' Set focus to other form
    Forms![TestForm].SetFocus

    ' this will work too: Forms("TestForm").Setfocus

    ' do filtering stuff here...
    DoCmd.RunCommand acCmdFilterByForm

End Sub

If you have save, delete, etc buttons, you just need to set focus to main form before using DoCmd.RunCommand acCmdSaveRecord, etc. commands.
0
 
LVL 1

Author Comment

by:michaeldi
ID: 2730210
I wanted to make is look all the same, mainly and have the Close button and Query button in the filter by form mode.
Because adventually when I finish the MDB i want to get rid of all standard tootlbars because only the relevant ones will be on the page they are in.

Thanks for the link and that code that will really help me.

If it cant be done then that is fair enough. If you do ever find out why you cant id be interested.

I will pose another Q to save you the hassle because explaining it will take some time.

Anyway thanks again for your help

Michaeldi






0
 
LVL 10

Expert Comment

by:paasky
ID: 2730405
Glad I could assist you. I will post here comments if I hear anything new about the button issue.

Best regards,
Paasky
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

609 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