Increment field by one is not working
I have some code:
Everytime when I'm clicking this event I want to see that SLFID is incrementing by 1.
The problem is that occur till 9 only and then staying on 10.
I have some code:
Code:
Private Sub SamplesReceived_Click()
Dim SLFIDUpdate As String
' avoiding "Write Conflict Error"
Me.Dirty = False
' open modal form with a current record
DoCmd.OpenForm "SamplesReceived", , , "[SamplesID]=" & Me![SamplesID]
' initiate new SLF for new arrived samples, increment last SLF by '1'
SLFIDUpdate = "UPDATE Samples " & _
"SET SLFID = " & CInt(DMax("[SLFID]", "Samples")) + 1 & _
" WHERE SamplesID = " & SamplesID
' update table 'Samples' , turn updating prompt off
With DoCmd
.SetWarnings False
.RunSQL SLFIDUpdate
.SetWarnings True
End With
End Sub
Everytime when I'm clicking this event I want to see that SLFID is incrementing by 1.
The problem is that occur till 9 only and then staying on 10.
Last edited: