You'll certainly need to use different code for SQL Server than for VFP source tables, unless you're using VFP 8 and autoincrement fields.
I think, though, that you're missing the point with getting a PK in VFP. If you use a view, that's an instance of the file that's unique to the user. So there's nothing to prevent two people from opening a view of a table at the same time and changing the same field in the same record at the same time. That's why I said you should not use a view for getting a PK. You must use a table on the server that is shared, and issue an RLOCK while you are getting the new PK.
>Hi Barbara;
>
>Thanks for your time and attention. I'm trying to write a generic routine that will work in all cases, whether using VFP tables or SQL server as the data store. As a rule, the underlying VFP tables are NOT buffered and are NEVER accessed directly - all communication is handled through views. If there's an update conflict, I revert and requery and go at it again.
>
>I'm just trying to understand what's happening under the covers - This may be one of those occasions where I have to branch the logic and handle native differently that SQL, but I hate to do that. Especially when it sounds like it should work first time, every time, when I read through the Online help.
>
>It's starting to feel like a SOLID wall.
>
>Thanks again!