KYT0002 diye artarak kayıt üretmesi lazım daha doğrusu tablonun en son kaytında ID alanında değer yoksa hata veriyor.
module
Function nurmaraAl(yb As String) As String
Dim donenDeger As String
Dim i As Integer
donenDeger = ""
For i = 1 To Len(yb)
If Mid(yb, i, 1) >= "0" And Mid(yb, i, 1) <= "9" Then
donenDeger = donenDeger + Mid(yb, i, 1)
End If
Next
nurmaraAl = donenDeger
End Function
form olayı
Private Sub Form_Current()
Dim strOldID As String
Dim lngCurrentNumber As Long
Dim lngNextNumber As Long
Dim strNextNumber As String
Dim strNewID As String
strOldID = DLast("[ID]", "t_Nakliyeler") 'tabloda ID Alanı boş değil
lngCurrentNumber = nurmaraAl(strOldID)
lngNextNumber = lngCurrentNumber + 1
strNextNumber = String(4 - Len(CStr(lngNextNumber)), "0") & CStr(lngNextNumber)
strNewID = "KYT" & strNextNumber
Me.t_islemno = strNewID
End Sub