>Hi ALL!
>
>I would like to have the first field on a form auto-increment with each new recorded added to the forms table. I know of the NEWID() way, but this involves modifing the table. Does any have any suggestions on how I can accomplish this useing just code?
>
>I considered useing the last Record number in the table and incrementing it by 1 each time, but No matter where I place my simple code, it gives errors and\or totally flips out the "add" function to the form.
Hi Dan,
I presume the number your want in first_field is the record count of the table, yes? If so,
In the refresh() method of first_field, include,
.value = RECCOUNT("myfirstfieldtable")
This assumes that you _do not_ link first_field to a control source.
Then in the whatever method you use to add a record (actually this should be in the add AND delete record functions), add the following line,
thisform.first_field.refresh()
that should do it.
regards,
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.comNo trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.