M
martyn
I have the following code in a form attached to event of a field called
Anything
Private Sub Anything_BeforeUpdate(Cancel As Integer)
Me![SID] = (Nz(DMax("[Sid]", "Steps", "[pID]=" & [PID]), 0) + 1)
End Sub
I have put it in to get sequential numbering and it works partly
Problems are that if I go into the form field Antything again for that
record and add or delete or make any changes it will increment the number
again. I dont want it to do this, once the number is generated it should be
fixed for that record. What do I need , some sort of If statement?
At some stage also I may need to insert or delete a record in which case
this no will be out of sync - but I will leave that to another post?
Anything
Private Sub Anything_BeforeUpdate(Cancel As Integer)
Me![SID] = (Nz(DMax("[Sid]", "Steps", "[pID]=" & [PID]), 0) + 1)
End Sub
I have put it in to get sequential numbering and it works partly
Problems are that if I go into the form field Antything again for that
record and add or delete or make any changes it will increment the number
again. I dont want it to do this, once the number is generated it should be
fixed for that record. What do I need , some sort of If statement?
At some stage also I may need to insert or delete a record in which case
this no will be out of sync - but I will leave that to another post?