> -- Now I retrieve the auto-number PK fwo_no just generated by the INSERT
> command
> SET VAR vnew_fwono = fwo_no in fwo_file where count = LAST
> EDIT USING fwo_form WHERE fwo_no = .vnew_fwono

Three notes to this:

1. Using WHERE COUNT = INSERT is more multi-user safe than COUNT = LAST since
another use may have added a record to the table after your INSERT and before
you edit the record.  COUNT = INSERT gets the last record _you_ added to the
table.

2. You can just do EDIT USING fwo_form WHERE COUNT = LAST instead of the
intermediate variable.

3. It's worthwhile to check the SQL code returned from the INSERT statement --
if the INSERT did not succeed for any reason the user will end up editing the
wrong record entirely and may not be aware of it.
--
Larry

Reply via email to