You have two things to check for! If your client changes an ID, you've got to make sure she doesn't use a value that's already used, too.
I suggest: DON'T DO IT! If the client insists on being able to change a number, insert another field for him to play with! Keep your own key values invisible.
To answer your question, if you have an index on the field, you can do an INDEXSEEK() to see if the value is already used. This is pretty quick. Alternatively, you can ORDER BY keyfield and GO BOTTOM to get the largest existing value.
>I have a numeric field I created in my clients.dbf
>
> Numbers are put automatically at every new register by:
>
>
> use clientes
> appe blank
> store ID to a
> a = a + 1
> replace ID with a
>
> As ID is not ready-only on the form
> because client asked so, how can
> I do to prevent duplicate IDs.
>
> Ps. A use free tables
>
>
>
>
>
>
>
>
>
Kogo Michael Hogan
"Pinky, are you pondering what I'm pondering?"
I think so Brain, but "Snowball for Windows"?
Ideate Web Site