lets say i have assignments in 3 different subjects (math, english,
science)... and people assigned to different assignments... so by their name
they get either a code of 1, 2, or 3 (representing math, english, or
science)....but they can have more than one different assignment within each
subject is for the autonumber count, because i wanted the number to come up
automatically, seeing how the next assignment number would increment for the
next person... not two people having the same assignment number within each
subject, but the next number...
subject assignment person name
1 1 karen
2 1 james
1 2 robert
1 3 paul
2 2 david
3 1 bobby
1 4 robert
2 3 karen
3 2 tim ..... and so on.......
An Autonumber would NOT be suitable for the purpose. For one thing, it
doesn't start over!
What is the structure of your tables? Hopefully you have a Students
table (with a unique StudentID, names are NOT unique); a Subjects
table, again with a SubjectID primary key; and a third table of
assignments? Why do you feel that you need an incrementing assignment
ID? If you have the Assignments table displayed on a Subform of a Form
based on either Subjects or Students, you'll just see the students for
that subject, or vice versa.
If you really need the number, you can put VBA code in the Subform's
Subject combo box AfterUpdate event:
Private Sub cboSubject_AfterUpdate()
Me!txtAssignmentNo = NZ(DMax("[AssignmentNo]", "[Assignments]",
"[Subject] = " & Me.cboSubject))+1
End Sub
John W. Vinson [MVP]