Solved

Searching item in List Box with Ctrl F

Posted on 2004-04-18
3
593 Views
Last Modified: 2012-05-04
I have a list Box with some data .

When I press CTRL F to search something there ,all the time I receive a pop up "not find"

AND "Look in" field  is disabe. It's mean I can't put any column name there .Or sometime I receive
"You can't use find or replace dialog"

What I need to do to activate it ?
Thanks.
0
Comment
Question by:Irina_dusha
3 Comments
 
LVL 26

Expert Comment

by:Alan Warren
Comment Utility
Hi Irina_dusha,

The FindRecord Action does not apply to listboxes, the listbox is not a searchable control.
You can find records in the active table datasheet, query datasheet, form datasheet, or form.

If you want to search a listbox you will need to loop through the ListItems collection of the control programatically. Basically means building your own search fuctionality.

Do you want more information how to do this?

Alan
0
 
LVL 7

Expert Comment

by:manthanein
Comment Utility
I don't know if you can use this, intead of using CTRL-F, why not filter the listbox for the item you are trying to find..  you need to add a textbox and 2 command buttons  to the trick .

lstDesc  is a listbox
Description is a textbox
QueDeviceDesc is the underlying table
QueDeviceDesc.Description is the field shown in the listbox

then on the command Button_on click event add this code
lstDesc.RowSource = "SELECT * " & _
        "FROM QueDeviceDesc " & _
        "WHERE  QueDeviceDesc.Description like '*" & Description.Text & "*'"
lstDesc = Null

to show all the records.. delete all the characters in the textbox before hitting the command button

-------------------------
another solution without the button..
add the  same code in the textbox's keyup event, that way the list box will be filtered as you type characters or delete them
:)
0
 
LVL 54

Accepted Solution

by:
nico5038 earned 125 total points
Comment Utility
The easy way around this is to change the listbox into a datasheet subform.
By removing the navigation buttons and the Allow Update/Delete/Add set to NO it won't differ much and you're able to use the CTRL+F and even the right-click options to filter and sort.

Nic;o)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now