472,809 Members | 2,490 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,809 software developers and data experts.

How to Filter on a List box

134 100+
I have a listbox which show customer Names on the 1st column and PO numbers on the 2nd column.
When user select the customer and press the OK button, it will access to the PO form.

Problem here is the list will grow longer and longer and I need to scroll up and down to look for the correct PO.

I would like to create a textbox below the listbox form, so when user type the customer name say 3 characters, it will filter only the customer started with 3 characters ,when user type the PO number say 3 char,it will filter all Po started with this number, so the list will be shorter and easy for user to see and select the PO.

I have tried using Filter on, realize that Listbox doesn't allow me to filter like below statement.

Me.Filter = "[customer] Like '*" & Me.txtCust & "*'"
Me.FilterOn = True

Do you have any better idea on how I should I do it, I don;t want to use the query expression that popup and display in a datasheet view, and user can change the data easily.

I am sure, the expert out there can enlighten me.
Dec 17 '06 #1
5 41910
PEB
1,418 Expert 1GB
Hey in the combo boxes it can be done a bit easier!

If u have a combbox and u type the first 3-4 characters the list is limited to the entries that begin with those characters!

But however maybe u want to keep the list?


I have a listbox which show customer Names on the 1st column and PO numbers on the 2nd column.
When user select the customer and press the OK button, it will access to the PO form.

Problem here is the list will grow longer and longer and I need to scroll up and down to look for the correct PO.

I would like to create a textbox below the listbox form, so when user type the customer name say 3 characters, it will filter only the customer started with 3 characters ,when user type the PO number say 3 char,it will filter all Po started with this number, so the list will be shorter and easy for user to see and select the PO.

I have tried using Filter on, realize that Listbox doesn't allow me to filter like below statement.

Me.Filter = "[customer] Like '*" & Me.txtCust & "*'"
Me.FilterOn = True

Do you have any better idea on how I should I do it, I don;t want to use the query expression that popup and display in a datasheet view, and user can change the data easily.

I am sure, the expert out there can enlighten me.
Dec 17 '06 #2
PEB
1,418 Expert 1GB
Me.Filter = "[customer] Like '*" & Me.txtCust & "*'"
Me.FilterOn = True
for the list u should try this Mylistbox is the name of your list! and imagine that for your list you get the information from mytable!

Me!Mylistbox.RowSource= "SELECT * FROM mytable Where [customer] Like '*" & Me.txtCust & "*';"
Dec 17 '06 #3
jamesnkk
134 100+
for the list u should try this Mylistbox is the name of your list! and imagine that for your list you get the information from mytable!

Me!Mylistbox.RowSource= "SELECT * FROM mytable Where [customer] Like '*" & Me.txtCust & "*';"
Wow !, thank you so much, You are really an Expert ! Yes It Work, Hoorah !
Dec 17 '06 #4
I have a really stupid question. When you say add;

Me!Mylistbox.RowSource= "SELECT * FROM mytable Where [customer] Like '*" & Me.txtCust & "*';"

Where exactly do you add that? I go to my combo box properties and then is this added as VBA through an expression or in the row source or what?

Thanks!
Feb 2 '07 #5
Rabbit
12,516 Expert Mod 8TB
From what it looks like to me you'd add it to the After Update event of a text box control.

What happens is they'll type part of the name into a text box. The code will run and change the names that are displayed in the listbox.
Feb 2 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Robin Cull | last post by:
Imagine I have a dict looking something like this: myDict = {"key 1": , "key 2": , "key 3": , "key 4": } That is, a set of keys which have a variable length list of associated values after...
2
by: Salad | last post by:
I have a log file with a list of records. The log file can be unfiltered or filtered. I have a command button to call a data entry form from the log. At first I was only going to present the...
3
by: Vern | last post by:
The following code retrieves data into a dataset, and then creates a dataview with a filter. This dataview is then attached to a combobox. When the effective date changes, I would like to see the...
8
by: marcus.kwok | last post by:
I am having a weird problem and I have can't figure out why it is happening. I create an OpenFileDialog and set a filename filter. When the dialog first opens, the filter works correctly, and...
3
by: josejomonm | last post by:
I am having a list box where I will select the Plants (Plant-1 or Plant-2 Etc.) or leave blank for selecting all plants. Another list box in the same form where the supervisors list is provided. A...
1
by: lorirobn | last post by:
Hi, I have a list box on a form, whose row source points to a separate query. The query refers to a field on the form to filter records on the list box, like such: WHERE tblA.DesignType = !!...
3
by: Soulspike | last post by:
Form name to filter = frmSortFor Filter based on list box from frmTest= lstSortFor Form containing list box = frmTest Field (CompCodes) data format = "PM SM TS EW WA" I have a database that I...
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. ...
4
by: Twayne | last post by:
Hi, I've been playing with ' if(!filter_var($email, FILTER_VALIDATE_EMAIL)) ' on my server and it seems to be working 100%. Pretty handy. Any ideas where I could find a summary of the e-mail...
1
by: woodey2002 | last post by:
Hi Everyone and many thanks for your time.. I am trying to begin access and a bit of VBA i am enjoying it but I have a annoying problem I just can’t get any where on. My databse mostly includes...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 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: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 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...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{

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.