M
Matt_Burton
Guest
I am trying to increment a SerialNumber field by 1 to show the user what the next SerialNumber code should be.
The problem I have is SerialNumber is a combination of 3 Characters and 4 Numbers. ie CAM0001, CAM0002 etc...
The problem I have hit is that when I use + 1 to the number a single digit is being returned.
Hence if CAM0001 is the SerialNumber the incremented value it gives me is CAM2, not CAM0002 as required.
The Code I am currently using to create the Increment is as follows:
Private Sub SerialNumber2_Enter()
Dim Tempa
Dim Tempb
Dim Tempc
Dim Tempd
Tempa = Left(SerialNumber, 3)
Tempb = Mid(SerialNumber, 4, 4)
Tempc = Tempb + 1
Tempd = Tempa & Tempc
Me!Text2 = Tempd
End Sub
Text2 is my output textbox which I hoped would display CAM0002 but instead displays CAM2!
Does anyone have any ideas how to create a number increase and ensure a single digit isn't returned?
The problem I have is SerialNumber is a combination of 3 Characters and 4 Numbers. ie CAM0001, CAM0002 etc...
The problem I have hit is that when I use + 1 to the number a single digit is being returned.
Hence if CAM0001 is the SerialNumber the incremented value it gives me is CAM2, not CAM0002 as required.
The Code I am currently using to create the Increment is as follows:
Private Sub SerialNumber2_Enter()
Dim Tempa
Dim Tempb
Dim Tempc
Dim Tempd
Tempa = Left(SerialNumber, 3)
Tempb = Mid(SerialNumber, 4, 4)
Tempc = Tempb + 1
Tempd = Tempa & Tempc
Me!Text2 = Tempd
End Sub
Text2 is my output textbox which I hoped would display CAM0002 but instead displays CAM2!
Does anyone have any ideas how to create a number increase and ensure a single digit isn't returned?