Hi,

Using VFP 9.0 sp1, I have a listbox control setup where the bound column is
1 of 2 columns. I have the row source type set to 6 and have picked my two
fields from the cursor. Column one is an ID and column two is a name. When
I tab into or select the listbox I can type an ID and it finds it in the
list, pretty cool. However, my users really think in names, not ID's. How
can I allow the fast searching by the second column but still return the
first column in the value?

I tried simply changing the bound column to 2 but then it returned the name
not the ID, which I need for a lookup. I'm sure this can be done I just
haven't figured out how yet. Any suggestions?

Thanks in advance,
Linn

Re: Lookups in listbox? by Jack

Jack
Mon Sep 10 16:08:52 PDT 2007

On Mon, 10 Sep 2007 17:00:02 -0500, "Linn Kubler"
<lkubler@chartwellwisc2.com> wrote:

>Hi,
>
>Using VFP 9.0 sp1, I have a listbox control setup where the bound column is
>1 of 2 columns. I have the row source type set to 6 and have picked my two
>fields from the cursor. Column one is an ID and column two is a name. When
>I tab into or select the listbox I can type an ID and it finds it in the
>list, pretty cool. However, my users really think in names, not ID's. How
>can I allow the fast searching by the second column but still return the
>first column in the value?
>
>I tried simply changing the bound column to 2 but then it returned the name
>not the ID, which I need for a lookup. I'm sure this can be done I just
>haven't figured out how yet. Any suggestions?
>
>Thanks in advance,
>Linn

I don't think you can. I don't know of anyway to have the search
operate on any column except the first, probably because I think most
people would expect searching to occur on the first column.

If the users don't think in terms of ID, why not put the name in the
first column and the ID in the second? Set the bound column to 2 to
return the ID. If users don't care about the ID you should hide the
second column.

Re: Lookups in listbox? by Linn

Linn
Tue Sep 11 07:21:06 PDT 2007

Hi Jack,

Thanks for suggestion, looks like switching the columns is going to do the
trick. I will keep the ID column visible because it really is the best way
to tell the difference between two patients. Ex. to John Smith's.

Thanks,
Linn

"Jack Jackson" <jacknospam@pebbleridge.com> wrote in message
news:5djbe3t2ftid6ihq5sjm3p04briqtbbajl@4ax.com...
> On Mon, 10 Sep 2007 17:00:02 -0500, "Linn Kubler"
> <lkubler@chartwellwisc2.com> wrote:
>
>>Hi,
>>
>>Using VFP 9.0 sp1, I have a listbox control setup where the bound column
>>is
>>1 of 2 columns. I have the row source type set to 6 and have picked my
>>two
>>fields from the cursor. Column one is an ID and column two is a name.
>>When
>>I tab into or select the listbox I can type an ID and it finds it in the
>>list, pretty cool. However, my users really think in names, not ID's.
>>How
>>can I allow the fast searching by the second column but still return the
>>first column in the value?
>>
>>I tried simply changing the bound column to 2 but then it returned the
>>name
>>not the ID, which I need for a lookup. I'm sure this can be done I just
>>haven't figured out how yet. Any suggestions?
>>
>>Thanks in advance,
>>Linn
>
> I don't think you can. I don't know of anyway to have the search
> operate on any column except the first, probably because I think most
> people would expect searching to occur on the first column.
>
> If the users don't think in terms of ID, why not put the name in the
> first column and the ID in the second? Set the bound column to 2 to
> return the ID. If users don't care about the ID you should hide the
> second column.



Re: Lookups in listbox? by Anders

Anders
Tue Sep 11 10:53:37 PDT 2007

If you add a textbox for the user to enter a searchstring you can search
your cursor or array in its keypress method and syncronize that with the
listBox. If the user enters digits you look for the Id, otherwise the name.
As the query cursor and the listbox have the same rows, the
List1.ListIndex=RECNO('source').
you could also have en optiongroup Name | Idnumber and switch contents (and
sort order) of the listBox accordingly. The visible columns can remain the
same; if it's a search for numbers you have the column Id, name Id and the
ColumnWidths "0,100,30"
-Anders



"Linn Kubler" <lkubler@chartwellwisc2.com> wrote in message
news:OBBx%237H9HHA.1188@TK2MSFTNGP04.phx.gbl...
> Hi Jack,
> cursor and the
> Thanks for suggestion, looks like switching the columns is going to do the
> trick. I will keep the ID column visible because it really is the best
> way to tell the difference between two patients. Ex. to John Smith's.
>
> Thanks,
> Linn
>
> "Jack Jackson" <jacknospam@pebbleridge.com> wrote in message
> news:5djbe3t2ftid6ihq5sjm3p04briqtbbajl@4ax.com...
>> On Mon, 10 Sep 2007 17:00:02 -0500, "Linn Kubler"
>> <lkubler@chartwellwisc2.com> wrote:
>>
syncronis
>>>two
>>>fields from the cursor. Column one is an ID and column two is a name.
>>>When
>>>I tab into or select the listbox I can type an ID and it finds it in the
>>>list, pretty cool. However, my users really think in names, not ID's.
>>>How
>>>can I allow the fast searching by the second column but still return the
>>>first column in the value?
>>>
>>>I tried simply changing the bound column to 2 but then it returned the
>>>name
>>>not the ID, which I need for a lookup. I'm sure this can be done I just
>>>haven't figured out how yet. Any suggestions?
>>>
>>>Thanks in advance,
>>>Linn
>>
>> I don't think you can. I don't know of anyway to have the search
>> operate on any column except the first, probably because I think most
>> people would expect searching to occur on the first column.
>>
>> If the users don't think in terms of ID, why not put the name in the
>> first column and the ID in the second? Set the bound column to 2 to
>> return the ID. If users don't care about the ID you should hide the
>> second column.
>
>



Re: Lookups in listbox? by Linn

Linn
Wed Sep 12 13:32:31 PDT 2007

Thanks for the suggestions Anders, I hadn't thought of doing it this way
either. I think right now it's more functionallity than I want to add to
this application but I'll keep it in mind if enhancements are requested.

Thanks,
Linn

"Anders Altberg" <anders.altberg> wrote in message
news:%23ZDfvyJ9HHA.5456@TK2MSFTNGP05.phx.gbl...
> If you add a textbox for the user to enter a searchstring you can search
> your cursor or array in its keypress method and syncronize that with the
> listBox. If the user enters digits you look for the Id, otherwise the
> name. As the query cursor and the listbox have the same rows, the
> List1.ListIndex=RECNO('source').
> you could also have en optiongroup Name | Idnumber and switch contents
> (and sort order) of the listBox accordingly. The visible columns can
> remain the same; if it's a search for numbers you have the column Id, name
> Id and the ColumnWidths "0,100,30"
> -Anders
>
>
>
> "Linn Kubler" <lkubler@chartwellwisc2.com> wrote in message
> news:OBBx%237H9HHA.1188@TK2MSFTNGP04.phx.gbl...
>> Hi Jack,
>> cursor and the
>> Thanks for suggestion, looks like switching the columns is going to do
>> the trick. I will keep the ID column visible because it really is the
>> best way to tell the difference between two patients. Ex. to John
>> Smith's.
>>
>> Thanks,
>> Linn
>>
>> "Jack Jackson" <jacknospam@pebbleridge.com> wrote in message
>> news:5djbe3t2ftid6ihq5sjm3p04briqtbbajl@4ax.com...
>>> On Mon, 10 Sep 2007 17:00:02 -0500, "Linn Kubler"
>>> <lkubler@chartwellwisc2.com> wrote:
>>>
> syncronis
>>>>two
>>>>fields from the cursor. Column one is an ID and column two is a name.
>>>>When
>>>>I tab into or select the listbox I can type an ID and it finds it in the
>>>>list, pretty cool. However, my users really think in names, not ID's.
>>>>How
>>>>can I allow the fast searching by the second column but still return the
>>>>first column in the value?
>>>>
>>>>I tried simply changing the bound column to 2 but then it returned the
>>>>name
>>>>not the ID, which I need for a lookup. I'm sure this can be done I just
>>>>haven't figured out how yet. Any suggestions?
>>>>
>>>>Thanks in advance,
>>>>Linn
>>>
>>> I don't think you can. I don't know of anyway to have the search
>>> operate on any column except the first, probably because I think most
>>> people would expect searching to occur on the first column.
>>>
>>> If the users don't think in terms of ID, why not put the name in the
>>> first column and the ID in the second? Set the bound column to 2 to
>>> return the ID. If users don't care about the ID you should hide the
>>> second column.
>>
>>
>
>