A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Search Unbound Column in List Box



 
 
Thread Tools Display Modes
  #1  
Old August 25th, 2008, 03:44 PM posted to microsoft.public.access.forms
Jeefgeorge
external usenet poster
 
Posts: 23
Default Search Unbound Column in List Box

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
  #2  
Old August 26th, 2008, 03:28 AM posted to microsoft.public.access.forms
Allen Browne
external usenet poster
 
Posts: 11,706
Default Search Unbound Column in List Box

Have your search button do a DLookup() to get the numeric value that matches
the description. You can then match this number.

For help with DLookup(), see:
Getting a value from a table: DLookup()
at:
http://allenbrowne.com/casu-07.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jeefgeorge" wrote in message
...
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


  #3  
Old August 26th, 2008, 04:49 PM posted to microsoft.public.access.forms
Jeefgeorge
external usenet poster
 
Posts: 23
Default Search Unbound Column in List Box

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


"Allen Browne" wrote:

Have your search button do a DLookup() to get the numeric value that matches
the description. You can then match this number.

For help with DLookup(), see:
Getting a value from a table: DLookup()
at:
http://allenbrowne.com/casu-07.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jeefgeorge" wrote in message
...
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



  #4  
Old August 26th, 2008, 05:01 PM posted to microsoft.public.access.forms
Allen Browne
external usenet poster
 
Posts: 11,706
Default Search Unbound Column in List Box

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.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jeefgeorge" wrote in message
...
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


  #5  
Old August 26th, 2008, 05:08 PM posted to microsoft.public.access.forms
Jeefgeorge
external usenet poster
 
Posts: 23
Default Search Unbound Column in List Box

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.
  #6  
Old August 26th, 2008, 06:09 PM posted to microsoft.public.access.forms
Jeefgeorge
external usenet poster
 
Posts: 23
Default Search Unbound Column in List Box

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.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:02 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.