Use result from Combo box in Find

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a combo box from which the user will select a street name from a
unique list of street names.

I also have a list box that provides a list in which the street name is
included, however, the bound column of the list box is and autonumber ID
field.

What I would like to do is to be able to implement a Find and Find Next type
of interface where the user will select the street, and the first record
would be located in the list box. This will mean that I will have to somehow
locate the first record in the listbox with the street name value in the
record and somehow return the ID for that record so that I can set the focus
to that record in the list box.

I hope I have made my request clear enough.

Any help is appreciated.

Mr B
 
To make this simple let's say that there are 3 columns in a combo or list
box:

Column 0
Bound
ID

Column 1
Street

Column 2
ZipCode

The column width look like:
0";1,5";0.75"

The data would then look like:
Maple St. 22556

To refer to the bound column, just use:
Me.cboComboName

To refer to the second column, use:
Me.cboComboName.Column(1)

And to refer to the third column's value, use:
Me.cboComboName.Column(2)

Assuming the default of AutoExpand is left on, the combo will start matching
the street as soon as you type the letter "M", without any further code. To
do something similar for a list box you need to use a textbox and code, like
using:

http://www.datastrat.com/Download/ExpandingSearch2K.zip
 
Consider streets like Park Ave. in New York, or State St. in Chicago, or
Roosevelt Blvd. in Philadelphia. Each of those streets is very long and has
many zip codes. Every town with more than 1 zip code probably has a street
like this. So the answer is that you can't do it with any accuracy.

If you don't care about order and can accept addresses returned as they are
found in the database, or if you can lookup against a query has pre-ordered
addresses. Add a column to the underlying query, that parses out the street
name.

Then you just requery the form based on the list box.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
Back
Top