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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|