473,805 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4129
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.c omwrote:
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
5081
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 again. I came up with: std::cout << "Type a letter: "; char c = '\0'; while(!(std::cin >> c) || !std::isalpha(c))
1
1893
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 appear in alphabetical order. Richy.
2
1603
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 editor. Thanks -- David Veeneman Foresight Systems
3
4535
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 DataField="ProductID" HeaderText="ProductID" InsertVisible="False"ReadOnly="True" SortExpression="ProductID" /> <asp:BoundField DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName" />
1
2480
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 loops/recursion using printf("%s\n", my_string);. Instead of printing them, I need to sort them in alphabetical order, and record the amount of times a unique string appears. i.e it will print "ABCD 4" because ABCD appeared 4 times. "BCC 1" because BCC...
7
2716
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 always what you want. The solution of converting everything to lowercase or uppercase is closer, but it would be nice if capitalized words come before lowercase words of the same spellings. And I suspect ord() order may not be correct for some...
1
3146
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. I’ve been successful in doing this for most of the buttons, but I’m having trouble reprogramming some Apply Filter buttons on one form and could use some help. So I have a Contacts List form that lists all of the division’s staff members...
2
4188
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 lists one dropdown contains A to Z list like A,B,C,D..Z. 2nd list contains above items like All,Air,Books.Now I want that when I select A from A-Z list it will display A items in alphabetical order and the Top item should be "All" after that remaining...
4
2282
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 needed as some of the records have a lot of text. However, I've needed to apply both a form of filtering system, and a way of re-ordering the form so that it is alphabetical/numerical order, depending on whiching heading is clicked. I have achieved...
0
9716
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10607
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10359
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10104
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9182
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7645
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5541
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.