dmax on continuous forms

K

kremesch

I'm using dmax for my autonumber field, works great with single form view.
However, I'd like to have some forms as continuous but when I do this, the
"fake" autonumber doesn't seem to work, it only carries the previous number
over.
I'm using OfficeXP.

Thank you in advance
 
J

jl5000

Try this code in your forms on current event:

Private Sub Form_Current()
If NewRecord Then
Me.Line_No = Nz(DMax("[AutoNumFieldName]", "My_Table_tab", ""), 0) + 1
End If
End Sub
 
Top