WITH This IF .ListIndex = 0 AND !EMPTY( .DisplayValue ) IF !USED( 'company_tbl' ) use company_tbl in 0 ENDIF INSERT INTO company_tbl VALUES ( .DisplayValue ) .Requery() .Value = .DisplayValue ENDIF ENDWITHGenerally speaking, I use my combo boxes to display the desriptive text from a lookup table while setting its BoundColumn to 2 (this column contains the Primary Key of the entry in the lookup table). Then I just store the primary key of the lookup table entry as a foreign key in my data file. Since I use integer surrogate primary keys, I must also set BoundTo to true (This tells VFP to take the combo's value from its List rather than its Index when its value is numeric). I just set my columncount to 2 and set the column width of the 2nd column to 0 so the end-user never sees the surrogate key (which means nothing to him < s > )
LOCAL lnKeyValue WITH This IF .ListIndex = 0 AND !EMPTY( .DisplayValue ) IF !USED( 'company_tbl' ) use company_tbl in 0 ENDIF lnKeyValue = NEWID( 'company_tbl' ) INSERT INTO company_tbl VALUES ( lnKeyValue, .DisplayValue ) .Requery() .Value = lnKeyValue ENDIF ENDWITHIf you need to see how such a NEWID funstion would work, check out Tastrade, the sample application that ships with VFP. This is a stored procedure in the dbc.