Hi Mike
DO NOT store the box number and the letter in the same field. The box
number should be the foreign key field that relates your tblElements table
to your tblBoxes table.
Now, assuming your two fields are names BoxNum and ElementLetter, the next
letter can be found from:
Chr(Asc(Nz(DMax("ElementLetter","tblElements", _
"BoxNum=" & Me.BoxNum), "@")) +1 )
To break this down, working from the inner brackets outwards:
DMax(...) finds the highest letter used so far for the given BoxNum
Nz(..., "@") says to use an "@" sign (the ASCII character before "A") if
there is no record for that BoxNum
Asc(...) + 1 takes the ASCII code value for the letter we have found and
adds 1
Chr(...) converts the result back to a letter - the next one in the
sequence.