Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
List Box - Not showing old values no longer in the list
Message
From
14/04/2000 15:39:13
 
 
To
14/04/2000 07:05:31
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00359714
Message ID:
00359882
Views:
12
>Can this problem be solved...
>
>I have a list box : I need this because they can only select from the list items and not type a value in !
>
>But some of the old records have items that are no longer in the list.
>When I open the form with this record the item is not shown in the list box. I am assuming because it is not found in the list anymore.
>
>Is there someway to show the old values yet still only allow the user select from the popup???
>
>Thanks!

Tim,

I have the same problem with combo lists here is my solution...
(Is from one of my forms, so forgive me because I didn't change the alias names and also because I over comented, just to make it either clear or not so clear...). The list of available items is controled by another table called "schduler"


*!* Set the control source for this combo
THISFORM.pageframe1.page2.combo5.CONTROLSOURCE = 'dtable.attn'

*!* Clear the content of the combo
THIS.combo5.clear()

*!* The currently available items are in this table
SELECT SCHDULER

AFIELDS(aSchedulers)

*!* Create a cursor to hold items for the combo list
CREATE CURSOR _TEMP FROM ARRAY aSchedulers

*!* Select the available items
SELECT sname;
FROM SCHDULER;
GROUP BY sname;
INTO CURSOR _TEMP1

*!* Select from the source table the items that may not be available anymore
SELECT dtable.attn;
FROM dtable;
WHERE ALLTRIM(dtable.attn) NOT IN(SELECT _TEMP1.sname FROM _TEMP1);
GROUP BY dtable.attn;
INTO CURSOR _TEMP2

*!* Filling the main cursor, first, with the available items
SELECT _TEMP1

SCAN
INSERT INTO _TEMP (sname);
VALUES (_TEMP1.sname)
ENDSCAN

*!* Select the other items that may not be available anymore
*!* and add only if it is the actual value for the current record

SELECT _TEMP2

IF RECCOUNT() > 0

SCAN

IF ALLTRIM(dTable.attn) = ALLTRIM(_TEMP2.attn)
INSERT INTO _TEMP(sname) ;
VALUES (_TEMP2.attn)
ENDIF
ENDSCAN
ENDIF

*!* Add the items to the combo list
SELECT _TEMP
SCAN
THIS.combo5.ADDITEM(ALLTRIM(_TEMP.sname))
ENDSCAN


*!* Get rid of the temp cursors

SELECT _TEMP
USE

SELECT _TEMP1
USE

SELECT _TEMP2
USE

This combo is part of a pageframe, so I put it on the Activate method of the page where there in. To navigate they have to switch pages so this method is
fired every time the user chages from record to record

If you have a better solution, please let me know because, is also a problem that I have now.

Cheers!
An Intelligent fool can make things bigger and more complex... It takes a touch of a genius -and a lot of courage- to move in the opposite direction".
-Albert Einstein
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform