Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange Behaviour of Combo Box
Message
From
18/04/2013 13:06:37
 
 
To
18/04/2013 12:00:59
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01571365
Message ID:
01571378
Views:
32
>I am trying to populate a combo box using the following code in COMBO INT() Method.
>
>
>SELECT Distinct Exchange FROM SEARCHREPORT WHERE !ISNULL(Exchange) GROUP BY EXCHANGE INTO CURSOR EXCHANGEWISEOUTSTANDING
>This.RowSourceType= 0
>WITH This
>.AddItem('All Exchanges')
>
>GO Top
>SCAN
>Browse
>.AddItem(Searchreport.exchange)
>ENDSCAN
>ENDWITH
>This.Requery()
>Thisform.Combo1.Refresh
>Thisform.combo1.ListItemId=1
>
>
> I could see from the browse window that each record in cursor EXCHANGEWISEOUTSTANDING is scanned properly (Around 15 items).
>
>However at the end I get Combo with only two items "All Exchanges" and "SRBZ1001".
>"SRBZ1001" is neither at top nor bottom. Whats Going wrong ? What should I do ?

Get the Browse out of the SCAN loop. It moves the record pointer.

Also, you don't need bother DISTINCT and GROUP BY in the query. Either one will do and DISTINCT makes it more obvious what you're doing.

Finally, get rid of the call to Requery at the end of the loop. Unneeded and might cause trouble.

Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform