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:42:36
 
 
To
28/01/2002 06:14:47
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00611416
Message ID:
00611427
Views:
15
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


Try code like this after you add the new company. I assume that your company table has a primary key field that is auto-generated (i.e., you have a stored procedure that populates the primary key using a default value).
INSERT INTO Company (Area, CompanyName) ;
   VALUES (thisform.Combo1.value, thisform.Combo2.displayvalue)
lcKey = Company.CompanyID
WITH Thisform.Combo1
  .Requery()
  .Value = lcKey
  .Refresh()
ENDWITH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform