PDA

View Full Version : Filter button on the form



daniels012
01-08-2009, 11:07 AM
Is there a way to have the filter button on a form?
I know there is one in the menu bar, but I want it
on my form.
When I create a button using the wizard, I can create
a button, but the button dim's out when I add it
to the form.
Is there code i can write to keep it from dimming out?
Or maybe add the button to to a floating form or to
the form header? Something?

Thank You,
Michael

FrymanTCU
01-08-2009, 11:57 AM
I think the consensus around here is the Wizard is not your friend! I would add a button that would then allow you to build the filter SQL string and use Me.Form.Filter = SQLstr. As for the button being dimmed, do you have the option Filters = Yes or Me.Form.FilterOn = True?

CreganTur
01-08-2009, 12:53 PM
The wizard creates what is called "Bloat Code". It crams a lot of unnecessary error trapping and methods into the code it creates. That's why we stay away from it. Now, it can be a valuable way to learn code if you're trying to find out how to code one of the wizard's options.

As Fryman pointed out, you can setup a filter using SQL. There's a lot of good info in Access help on the subject.

daniels012
01-08-2009, 01:13 PM
ok
Let me see if I can explain.
We have a Work Order we enter all kinds of info on 5 different pages.
Once the work order is billed we go back and enter data into the
different pages.
I created a form to highlight just the areas we need all on one page
to make it easier to enter data.

What I want is to be able to go to the invoice I want by entering the
Work Order Number in a field on the form. I try to change the WorkOrderID
but this does not work. It tries to make a duplicate record and it
doesn't change to the record.
Is there a blank field to take me to the specific WorkOrder?

I tried to go the Filter route, the only issue I have is the ApplyFilter(funnel) is on the Menu Bar instead of the form.

Do I have oither options?

Michael

FrymanTCU
01-08-2009, 01:50 PM
This is not your only option so please keep searching but you could creat a new form which is unbound. Then add a text box for the WorkOrderID and have a Filter/Lookup Button. Then add a subform that is filtered by the data you entered into the field. There should be a simple example of this somewhere online, I can't look right now I'm at work.