Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convincing a combobox to requery itself
Message
From
26/07/1999 09:16:35
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00244431
Message ID:
00246028
Views:
20
>I created a class based on a combobox to display a list of cities. The RowSourceType is 3-SQL. I build the SQL statement in the init and replace the RowSource.
>
>Init ex:
>
>local lSource
>lSource = "SELECT * FROM city WHERE !DELETED() ORDER BY 1 INTO Cursor " + This.Name
>This.RowSource = lSource
>This.Refresh
>
>This works fine.
>
>In the right click event I placed the following:
>
>local lcNewCity
>lcNewCity = proper(EditTextBox("", "Add new city"))
>Insert into city (cityname) value (lcNewCity)
>This.requery
>This.refresh
>This.value = lcNewCity
>This.Displayvalue = lcNewCity
>
>When I run the form the combo displays all the current records, however if I rightclick and add a city it doesn't show up? I browsed the actual cursor and it's not there. It does exist in the base table, and will show up in the combo the next time I run the form.
>
>Any ideas?
>
>TIA

Roi,

The cursor created by your SQL is read-only. IE, you can't write to it. The way you are going, you would have to kill the cursor, requery and rebind it. Try this. Create a view of your table, and base your combo on the alias of the view instead of sql. Then you can insert a record into the table, requery the view and refresh the combo box and your new entry should be there without you having to jump through flaming hoops to get it there.

Regards,

Jason
Jason Tryon
Senior Systems Analyst / Technical Lead
eBusiness / iPage
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform