Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi all, i have a table with 2 au

Status
Not open for further replies.

pronate

Technical User
Jul 7, 2002
64
SG
Hi all,

i have a table with 2 autoNumber field in it.

One autoNumber I used it as a primary key to link to another table. The other one i want to use it as a Job Number, if that record requires some internal machining job to be done.

I cannot use the primary key as the job card because some record has no internal jobs required. And my job number got to be running and must not skip.

Please advise.

Cheers
Sam

 
You can't have 2 AutoNumber fields in the same table.
Second field would be a 'code incremented' numeric field.
There are several ways to increment a value through code.
You could use the BeforeUpdate event of the form where you enter the info:

Sub Form_BeforeUpdate(Cancel As Integer)
JobNumber = Nz(Dmax("JobNumber", "YourTableName"),0)+1
End Sub

JobNumber must not skip??? Then do not allow deletions and edits on any control bound to that field.

HTH,

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top