Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to keep a new value in a Combo box?
Message
From
28/01/2002 06:14:47
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
How to keep a new value in a Combo box?
Miscellaneous
Thread ID:
00611416
Message ID:
00611416
Views:
72
I have a form, 2 combo boxes, 3 tables, 1 is Invoice, 1 is Area and the 3rd one is Company. Combo1's row source is Area, Combo2's row source is Company and its control source is Invoice's CompanyName. When I add a new record of Invoice(I used "Append Blank") , the form will open and the user will select the Area from Combo1, then Combo2 will filter the Companies which belongs to that Area. I set the RowSourceType = SQL and in its GotFocus event:
this.RowSource ="Select CompanyName from Company where Area = thisform.Combo1.displayvalue into cursor tmp"
And its LostFocus event:
this.RowSource ="Select CompanyName from Company into cursor tmp" in order to cancel the filtering.
Then I have an "Add Company" button, its click event is:
INSERT INTO Company (Area, CompanyName) ;
VALUES (thisform.Combo1.value, thisform.Combo2.displayvalue)
thisform.Combo2.RowSource ="Select CompanyName from garden into cursor tmp"
The idea is when I am creating an Invoice, I allow the user to create a new Company by typing in a new company name in Combo2 before it save the Invoice. The problem is, after clicked this button, the new Company is created but it will disappear at once in the Combo2 and it becomes blank. I need to click the Combo2 and select the new company again then save the Invoice form.
Quite complicated, huh? Hope my explanation is clear enough to tell you the situation. How can I keep the new value in the Combo2?

Thanks
Power Wong
Every problem will have a solution, the only problem is that can you find it out.
Next
Reply
Map
View

Click here to load this message in the networking platform