Search Unbound Column in List Box

J

Jeefgeorge

I have a 2 column list box on a form. The first column is a Standard Number
which is a unique field. The second column shows a description for each item.
I would like to create a search button to find a particular item. The
problem is when I set the focus to the list box, the first column is
searched. Is there a way to set the focus to the second column in the list box
 
J

Jeefgeorge

it is my understanding that DLookup only returns one value. I would like to
return several values.

example:
The user types 8" into the search box

the listbox is then populated with all line items with 8" in the description
i.e. PVC Water Main 8", 8" x 6" Cross, 12" x 12" x 8" Tee
 
A

Allen Browne

In that case you will need to filter the form, so it shows all the matches
instead of matching one record.

Create a query that uses your main table, and the table that contains the
description. You can then filter the form by the description.
 
J

Jeefgeorge

Private Sub Find_Line_Item_Click()
DoCmd.[LineItemList].[Column](1).SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
End Sub

If the syntax for the setfocus command were valid, this is what I would like
to do. Where the find next button on the find popup window allows the user
to scroll through all the matches.
 
J

Jeefgeorge

That response was fast...

I ended up not using what you advise, but it did lead me to what I used.
I added a [Search] textbox on the form and changed the source property for
the list box.

Source for the List Box:
SELECT EstGuide.StdNo, EstGuide.Description, EstGuide.Unit
FROM EstGuide
WHERE (((Left([StdNo],1))=[Form]![Prefix]) AND
(("0")<>IIf(IsNull([Form]![Search]),"1",InStr(1,[Description],[Form]![Search]))))
ORDER BY EstGuide.StdNo;

Also in the afterupdate for the [Search] I requery the textbox

Thanks for the idea.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top