I have create a combo box, which show all student names in the 1st column, If I want to find name call Jack, I would type the frist few character say JAC, automatically the combo box will point me to the nearest name that start with JAC,
How can I only show those students names that start with JAC..., in the combo box list, and hide the rest of the student names that not start with JAC.
13 3060
I have create a combo box, which show all student names in the 1st column, If I want to find name call Jack, I would type the frist few character say JAC, automatically the combo box will point me to the nearest name that start with JAC,
How can I only show those students names that start with JAC..., in the combo box list, and hide the rest of the student names that not start with JAC.
for this better you can use a listview and textbox because if you want to do that in comboBox you have to clear the combo list and there may clearing combo text also.
so, better you can use a listview and textbox
for this better you can use a listview and textbox because if you want to do that in comboBox you have to clear the combo list and there may clearing combo text also.
so, better you can use a listview and textbox
I know how to build this in a List box, but may not suitable in my current form development, would you mind explain what you mean by clea the combo list and combo text.
ADezii 8,834
Recognized Expert Expert
I have create a combo box, which show all student names in the 1st column, If I want to find name call Jack, I would type the frist few character say JAC, automatically the combo box will point me to the nearest name that start with JAC,
How can I only show those students names that start with JAC..., in the combo box list, and hide the rest of the student names that not start with JAC.
'You can programmaticall y change the RowSource Property of the Combo Box. Assuming a Combo Box name of cboTest with Column Count = 1, Bound Column = 1, RowSourceType = Table/Query, and a [FirstName] Field in tblEmployees: - Dim MySQL As String
-
MySQL = "SELECT tblEmployees.FirstName FROM tblEmployees WHERE " _
-
& "tblEmployees.FirstName Like 'JAC*' ORDER BY tblEmployees.FirstName;"
-
-
Me![cboTest].RowSource = MySQL
-
Me![cboTest].Requery
Output: Produces only First Names that begin with JAC...
'You can programmaticall y change the RowSource Property of the Combo Box. Assuming a Combo Box name of cboTest with Column Count = 1, Bound Column = 1, RowSourceType = Table/Query, and a [FirstName] Field in tblEmployees: - Dim MySQL As String
-
MySQL = "SELECT tblEmployees.FirstName FROM tblEmployees WHERE " _
-
& "tblEmployees.FirstName Like 'JAC*' ORDER BY tblEmployees.FirstName;"
-
-
Me![cboTest].RowSource = MySQL
-
Me![cboTest].Requery
Output: Produces only First Names that begin with JAC...
Thanks for the code, but in your sql statement, you defined Jac, what I mean is just an example user may type in jac or Pet or any characters, how would I put into the sql ?
NeoPa 32,566
Recognized Expert Moderator MVP
James,
What you're asking for is a redefinition of the ComboBox object itself. Alternatively, handle the keypresses. You will discover just how many different situations need to be handled for it to work properly.
I'm afraid the short answer is that this is not supported.
James,
What you're asking for is a redefinition of the ComboBox object itself. Alternatively, handle the keypresses. You will discover just how many different situations need to be handled for it to work properly.
I'm afraid the short answer is that this is not supported.
Thanks, you understand my question, I got this idea which I saw an application was able to handle it. You are right, When I try different method, I realize th hardest part was the keypress. Adezil also provide a very good solution
Thanks, you understand my question, I got this idea which I saw an application was able to handle it. You are right, When I try different method, I realize th hardest part was the keypress. Adezil also provide a very good solution
Your simplest option might be to have a separate textbox where the user types the search string. Each time the value is changed in the textbox, requery the combobox with the modified WHERE clause.
Question for the experts - does the Access combobox have a Sorted property, as in VB6? I couldn't see one.
NeoPa 32,566
Recognized Expert Moderator MVP
I read your post Killer and thought 'He's ripped that from my post.'
Then I reread my post and remembered I'd taken that idea out :sheepish grin:
A problem with that idea is that getting access to the characters passed is not too easy until BeforeUpdate is triggered.
You can do it, but it's very fiddly.
A ComboBox doesn't have a sorted facility, but the RowSource can easily include a sort (Either an ORDER BY if it's SQL or sorting within a QueryDef - Tables are more complicated :().
I read your post Killer and thought 'He's ripped that from my post.'
Then I reread my post and remembered I'd taken that idea out :sheepish grin:
This is not the first time we've been guilty of thinking alike.
It's nice to meet another intelligent person now and then. :)
A problem with that idea is that getting access to the characters passed is not too easy until BeforeUpdate is triggered.
You can do it, but it's very fiddly.
I'm afraid you lost me there. Which "characters passed" are you referring to? If you mean the value of the textbox, I'd have thought the OnChange event would allow you to do it pretty easily. Not that I have much experience in this area (in VB, yes; Access, no).
A ComboBox doesn't have a sorted facility, but the RowSource can easily include a sort (Either an ORDER BY if it's SQL or sorting within a QueryDef - Tables are more complicated :().
Yeah, the SQL posted here included the ORDER BY, and I just wondered whether it was necessary. Guess I just find it hard to accept how much functionality MS threw away when "porting" VB to Access, etc.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Sean |
last post by:
Greetings all,
I am attempting to make a form that will filter through several tables
that
(I believe) have refretial integrity. I am pulling data from several
tables into the form and i would like to eventually be able to filter
down through the
tables untill i can reach one unique record. I am creating a datbase
to keep track of...
|
by: Scott Loupin |
last post by:
I've got two databases with similar data in them (WestSide and EastSide).
I've set up two identical reports that is filtered by date and the client
name. I'm using one form to do the filtering.
Currently, I've used queries to combine the two client lists, so when I open
the combo box, I have many names I need to scroll through until I find...
|
by: MLH |
last post by:
I have a form (xxxxxxxxxxxxxx) with a combo-box control
(yyyyyyyyyyyyyy). The rowsource property for that combo box is as
follows:
SELECT DISTINCTROW .,
. FROM ;
The SQL for qryVehicleList is ...
SELECT & " " & & " " & & " & "]" AS Vehicle, tblVehicleJobs.VehicleJobID,
tblVehicleJobs.OwnerID, tblVehicleJobs.AuthID,...
|
by: Mike Jakes |
last post by:
I hope that someone can offer a little advice on this one - I've
searched the group but can't find an answer. I think that I'm doing
something really stupid or missing something trivial, but see what you
can make of this...
I have a main form "Events" that contains a tab control. The tab
control has 7 pages. The 7th page (named "Boats")...
|
by: tlyczko |
last post by:
I read about limiting combo boxes' list data, for example, limiting the
list of values in the second combo based on values in the first combo,
and I found the Dev Ashish site link.
I have two combos based on lookups of very small tables, Audit
Descriptions and Programs.
Combo 1: Audit Descriptions has Comprehensive, Fire Safety, Medical,...
| |
by: hackerslacker |
last post by:
I have an ordering form that use two combo boxes to filter down the
records of a Products table. This worked fine with the after_Update of
the first filtering the records and creating the rowsource of the
second combo. The second combo's control source is the Product ID field
(foriegn key) on the Orders table.
Everything worked well until...
|
by: jjyconsulting |
last post by:
Newbie needing some help. I have a tblParticipants. The fields
include gender, education_level, income, occupation etc., I'm trying to
create a form where a user can run a query from the form and just
choose the appropriate criterias from the combo boxes to get the
results. I also want the query to run even if there is not a value in
all...
|
by: salad |
last post by:
I was wondering how you handle active/inactive elements in a combo box.
Let's say you have a combo box to select an employee. Joe Blow has
been selected for many record however Joe has left the company and has
been flagged inactive. If you have a filter on the rowsource like
Where Active = True
then Joe's name would not show up in the combo...
|
by: Dev1 |
last post by:
All-
I'm new to this forum and i've been working with acces for about 2 days now. I have a form in which I have two combo boxes and depending on what is selected on the first dropdown the second one gets populated accordingly, which is great! There are two problems;
First the when I select the value from the second drop down the value in...
|
by: flymo |
last post by:
Hello All,
I've bee trying out access 2007 and have a weird issue and would like
to see if I'm issing something really basic.
I have a form based on a query, I create a combo to look for records
on my form based on Org_ID. Wgen I create all is fine - I type e,
combo goes to e and starts filtering etc just like normal......I save
the form,...
|
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...
| |
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...
|
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. ...
|
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...
|
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...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |