473,419 Members | 2,060 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 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 4104
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.