>>>You can't be sure that this value is the value of the record YOU added unless you didn't have some other UNIQUE field.
>>
>>I don't have any extra unique fields, the AutoInc field is my PK field. Is there a way to get it in AfterInsert?
>>
>>I asked the same question on the Russian forum as well.
>>
>>Can I get it in VFP9? If yes, then I just hide this field for now from the form.
>>
>>I guess I can implement your code in AfterInsert, correct? For VFP8 version.
>
>You must lock the table BEFORE you run TableUpdate becuase if two users run TABLEUPDATE() at the same time you'll never be sure which value you got in AfterInsert.
>
>In VFP9 You could Set these properties in the CA:
>
>this.InsertCmdRefreshCmd = [SELECT ID FROM YourTable WHERE Id = GETAUTOINCVALUE(0)]
>this.InsertCmdRefreshFieldList = [Id]
>
>Where (this.) is your CA class. Never tested though (tomorrow I'll do because I'll need it and must be sure that this works)
>If I didn't come back with answer (because i am going to sleep right now, please remind me tomorrow)
>
>I now that these properties works when i deal with SQL Server but never tested them with NATIVE tables.
Thanks a million for your help and have a nice dream <g>
If it's not broken, fix it until it is.
My Blog