add numeric ID based on Department

P

PowellGirlTN

I have a table to record employees for a small company. I need to assign a
unique numeric ID to each employee based on their deparment. I have the
field DeptID in my table. How can I auto fill numeric values starting with 1
in the field DeptEmplID so it automatically assigns the numeric value for
each person in each department? I appreciate your help, thank you.
 
L

Linq Adams via AccessMonster.com

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.NewRecord Then
Me!DeptEmplID = Nz(DMax("DeptEmplID", "YourTableName"),0) + 1
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top