Listbox causing error  
Author Message
Gemstones





PostPosted: Visual FoxPro General, Listbox causing error Top

Hi

I have a listbox in which I fill with values from a SQL based on a selection chosen by the user. The listbox allows the user to select the value they want from the list and enter payments for that person. However my problem occurs in instances where the list box contains more records that are shown in the main listbox window and the user has to scroll down the list. This is usually 500 or more records. When the user selects any of the records nearing the end of the list, the entire application closes with an error saying "Syntax error" and it is going straight to the read events. It however does not tell me where the syntax error is. For any of the records closer to the beginning, everything works fine.

Help please. I have run out of ideas to fix same. I tried rerunning the Query and clearing the listbox and refilling it, but the same thing occurs once the previous record selected was near the end of the list.

Thanks




Visual FoxPro2  
 
 
CetinBasoz





PostPosted: Visual FoxPro General, Listbox causing error Top

Filling and refilling, how do you fill it With SQL source I assume rowsourcetype should be 3-SQL, is it If not try making it 3.

Also think of using a grid instead. Grids can do anything a litbox does plus more.


 
 
Gemstones





PostPosted: Visual FoxPro General, Listbox causing error Top

I have tried using grids before, but somehow I can not get the hang of how they work.

To fill the list box i run a SQl query and save it to a temp file and then i fill the list box with the fields from the file that I need.



 
 
CetinBasoz





PostPosted: Visual FoxPro General, Listbox causing error Top

No need to do like that. Directly set the SQL as the rowsource. ie:

* listbox.init
with this
.RowSourceTYpe = 3
.RowSource = "select field1,field2 from myTable"+;
" where ..."+;
" order by ..."+;
" into cursor crsMyList"
endwith

Listbox have quirky numbers like 32767 max indexid. Rethink using the grids.