472,958 Members | 2,144 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

Alphabetical Filter Bar

I have been creating a contact management database which now has about
300 records in it. I've been filtering using the "filter by form"
command but I'd like to automate this with a set of buttons at the top
of the form. The buttons would look something like this:

ABC DEF GHI JKL MNO PQRS TUV WXYZ

Each button would filter the records by Last Name.

Being a newbie to Access, I don't know exactly how to do this. I'm
assuming I use a command button. But what I don't know is whether to
use a filter, a simple query or a parameter query and just how to link
the button to the solution I choose.

If some one could offer me general direction here I'd be grateful. If
you supply me with the basic method, I can lookup the details in
Access Help or on the Microsoft support site.

Thanks!

Matt Edminster

Aug 11 '07 #1
2 4058
Chiinook - yes command buttons would work for this
In the command button's "on click" event, you would (in the code
builder) put the following visual basic code:

Me.Filter = "left([LastName],1) in ('a','b','c')"
Me.FilterOn = True
(assuming your field name - not the textbox name- is "LastName")

You will have to have some other method for turning off the filter,
maybe a "reset" button, for which you would say:
me.filter0n= false

OR --
You could make a fancier search instead of all those buttons, by using
an unbound textbox (maybe placed in the form's header). The user could
type in the beginning of a name (or just one letter), and then click a
button and the form would filter to anything that resembles what they
typed. For this you would say: (again in the 'on click' event)

me.filter ="LastName like '" & me.txtSearchBox & "*'"
me.filterOn = true

These solutions assume that you have all the records loaded into the
form to begin with. When you start getting really large sets of data, or
have several users, its often good to not load all the data at once, but
just load the data that you are "searching" for. In this case, you set
the form's recordset on the fly -- This is probably fancier than you
need or want right now, but just letting you know about the method.

hope this helps
-John
chiinook wrote:
I have been creating a contact management database which now has about
300 records in it. I've been filtering using the "filter by form"
command but I'd like to automate this with a set of buttons at the top
of the form. The buttons would look something like this:

ABC DEF GHI JKL MNO PQRS TUV WXYZ

Each button would filter the records by Last Name.

Being a newbie to Access, I don't know exactly how to do this. I'm
assuming I use a command button. But what I don't know is whether to
use a filter, a simple query or a parameter query and just how to link
the button to the solution I choose.

If some one could offer me general direction here I'd be grateful. If
you supply me with the basic method, I can lookup the details in
Access Help or on the Microsoft support site.

Thanks!

Matt Edminster
Aug 11 '07 #2
John

That helps immensely! Thank you.

Matt

On Aug 11, 4:00 pm, John Welch <so...@nospam.comwrote:
Chiinook - yes command buttons would work for this
In the command button's "on click" event, you would (in the code
builder) put the following visual basic code:

Me.Filter = "left([LastName],1) in ('a','b','c')"
Me.FilterOn = True
(assuming your field name - not the textbox name- is "LastName")

You will have to have some other method for turning off the filter,
maybe a "reset" button, for which you would say:
me.filter0n= false

OR --
You could make a fancier search instead of all those buttons, by using
an unbound textbox (maybe placed in the form's header). The user could
type in the beginning of a name (or just one letter), and then click a
button and the form would filter to anything that resembles what they
typed. For this you would say: (again in the 'on click' event)

me.filter ="LastName like '" & me.txtSearchBox & "*'"
me.filterOn = true

These solutions assume that you have all the records loaded into the
form to begin with. When you start getting really large sets of data, or
have several users, its often good to not load all the data at once, but
just load the data that you are "searching" for. In this case, you set
the form's recordset on the fly -- This is probably fancier than you
need or want right now, but just letting you know about the method.

hope this helps
-John

chiinook wrote:
I have been creating a contact management database which now has about
300 records in it. I've been filtering using the "filter by form"
command but I'd like to automate this with a set of buttons at the top
of the form. The buttons would look something like this:
ABC DEF GHI JKL MNO PQRS TUV WXYZ
Each button would filter the records by Last Name.
Being a newbie to Access, I don't know exactly how to do this. I'm
assuming I use a command button. But what I don't know is whether to
use a filter, a simple query or a parameter query and just how to link
the button to the solution I choose.
If some one could offer me general direction here I'd be grateful. If
you supply me with the basic method, I can lookup the details in
Access Help or on the Microsoft support site.
Thanks!
Matt Edminster

Aug 11 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Eric Lilja | last post by:
Hello, in my program I need to ask the user to input some alphabetical letters. Case should not matter. Any input that isn't an alphabetical letter should be rejected and the user prompted to try...
1
by: Richy Rich | last post by:
Hi, This may seem like a really stupid question, but I cannot get the source files to appear in alphabetical order in the solution explorer. I've clicked on the A...Z icon, but they don't...
2
by: David Veeneman | last post by:
Is there any way to change the default view in Visual Studio's property editors from categorical to alphabetized? I'm getting awfully tired of clicking the A-Z icon every time I open a collection...
3
by: simonZ | last post by:
In gridView I have dropdown list : <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ProductID" DataSourceID="SqlDataSource1"> <Columns> <asp:BoundField...
1
by: quirdan | last post by:
Hi, I am after some advice about which data structures I should use. I'm developing a program and I am at the point where all the strings are being generated and printed one by one with...
7
by: Ron Adam | last post by:
I have several applications where I want to sort lists in alphabetical order. Most examples of sorting usually sort on the ord() order of the character set as an approximation. But that is not...
1
by: eHaak | last post by:
A couple years ago, I built a database in MS Access 2003. I built the form using macros in some of the command buttons, and now I’m trying to eliminate the macros and just use visual basic code. ...
2
by: pavanip | last post by:
Hi, I have a problem with binding data to dropdownlist from database in alphabetical order. My database contains some fields like All,Air,Airline,Books,Cars etc. There are 2 dropdown...
4
by: Adam Tippelt | last post by:
Situation: I'm using a continuous form to display a lot of information stored in a datasheet. I'm using the form because it allows me to display multiple rows of information per 'record' which is...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.