Filter A Continuous Form By Text Box Input, Access 2010 Web

kong_haakon

Registered User.
Local time
Today, 23:08
Joined
Jan 30, 2013
Messages
18
Hello all of you enlightened!

I have a problem with getting a form filtered the way I want..
This is a simple contact-database, with one table, to be published on sharepoint. I have a navigation form with three subforms, one of wich is a Continuous form based on the table of the DB.
I've added 4 textboxes on top of this form, to input the parameters i want to filter the form by, but I cant get the macros to work properly..

The form shows a contact list, and the text boxes is Name (wich should filter the columns FirstName and LastName in the table), Instrument (to filter two columns called instrument1 and instrument2), Area (to filter the column called area), and status (to filter the column called status) The two latter I would actullay prefer a combobox, but one thing at the time..

I've also added a Filter commandbutton, and a Remove Filter commandbutton, but i'm not shure if i need those in a continous form like this if I get the filtering to work..

So my problem is figuring out what to write in the macros, set the tempvars correctly (or localvars?) and make the form show all the hits based on the info on the textboxes. They should also allow for any of the fields to be left blank as to allow that parameter to return all records.

Should the macros be "written" under the textboxes or under the command button? Or maybe a bit of both?

I've tried the method explained here: http://blogs.office.com/b/microsoft-access/archive/2010/04/21/macros-search-form.aspx , but I'm apparently doing something wrong.


ANY ideas will be highly appreciated! This is so simple in theory but I can litteraly touch my own incompetence here :)

Thank you!
 
I have done this with a simple unbound text box and an after update event macro on the text box. In the macro I use the SetFilter command. I don't know if this works for multiple filters but it does work for one simple filter. Maybe something to try?
 
I have done this with a simple unbound text box and an after update event macro on the text box. In the macro I use the SetFilter command. I don't know if this works for multiple filters but it does work for one simple filter. Maybe something to try?

Hello Triplee and thanks for looking at this!

Sorry for my late reply!

Yeah thats exactly what I'm doing but I cant get the logic right or the textbox macro..
At least it seems as I'm on the right path, only not quite there yet..


KOng_haakon
 
Hi,

Here is my code. FYI, I have a form inside a nagivation form. txtFilter is the unbound textbox with a "*" as the default value.

Macro (triggered by After Update Event on the unbound textbox):

<Action Name="SetFilter"><Argument Name="WhereCondition">[FilteredField] Like [Forms]![Main]![NavigationSubform].[Form].[txtFilter].[Value]</Argument></Action>

Filter property on form:

[FilteredField] Like [Forms]![Main]![NavigationSubform].[Form].[txtFilter].[Value] ..... which has been set by the macro I guess.

I am no access expert but this works for me on one single filter. With several filters I guess you have to use some AND logic, but I have not tried it myself.

Simple as that! I have not pressure tested my filter very much but have not seen any glitches yet.

Good luck!
 
Hi,

Here is my code. FYI, I have a form inside a nagivation form. txtFilter is the unbound textbox with a "*" as the default value.

Macro (triggered by After Update Event on the unbound textbox):

<Action Name="SetFilter"><Argument Name="WhereCondition">[FilteredField] Like [Forms]![Main]![NavigationSubform].[Form].[txtFilter].[Value]</Argument></Action>

Filter property on form:

[FilteredField] Like [Forms]![Main]![NavigationSubform].[Form].[txtFilter].[Value] ..... which has been set by the macro I guess.

I am no access expert but this works for me on one single filter. With several filters I guess you have to use some AND logic, but I have not tried it myself.

Simple as that! I have not pressure tested my filter very much but have not seen any glitches yet.

Good luck!


Thanks again for looking at this and sorry for my late reply!

I'll try this right away! I can't understand why it should be an obstacel to have more than one filter like this.
But I gues getting one to work properly is the first I need to accomplish :)

I'll let you know how it goes!
 
Hi Again!

Made it work!

Had to set tempvars on all the textboxes, and then an apply filter, also on the textbox/combobox

Linking several fields to the same textbox was easy, once i figured out that I had to change AND with &
Sometimes it`s so much closer than you think!

So now all the filters work as they should, but only one at the time :)

Next; Find a solution to make several filters apply at the same time!

Thanks for your replies!
 

Users who are viewing this thread

Back
Top Bottom