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 formTry 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