Skip to main content

AccessTr.neT


Aya Göre Otomatik Numara Verdirme

Aya Göre Otomatik Numara Verdirme

#7
KIRMIZI OLAN KISIM DEĞİŞECEK

Private Sub TARİH_AfterUpdate()

Dim GecerliAy, Gecerliyil, GSayimiz As Integer
Dim GSorgum As String
Dim rs As DAO.Recordset


If IsNull(Me.SIRA_KOD_NO) Or Me.SIRA_KOD_NO = "" Then

GecerliAy = Month([TARİH])
Gecerliyil = Year([TARİH])
GSorgum = "SELECT TOP 1 [1].SIPARISNO, [1].[SIRA KOD NO], Int(Left([SIRA KOD NO],InStr(1,[SIRA KOD NO],'-')-1)) AS GAy, Int(Mid([SIRA KOD NO],InStr(1,[SIRA KOD NO],'-')+1)) AS GSira FROM 1 WHERE ((Not ([1].[SIRA KOD NO]) Is Null) And ((Int(Left([SIRA KOD NO], InStr(1, [SIRA KOD NO], '-') - 1))) like '" & GecerliAy & "')) ORDER BY Int(Mid([SIRA KOD NO],InStr(1,[SIRA KOD NO],'-')+1)) DESC;"

Set rs = DBEngine(0)(0).OpenRecordset(GSorgum, dbOpenDynaset)

    If rs.EOF Then
   
        GSayimiz = 1
       
    Else
   
        GSayimiz = Int(rs(3).Value) + 1
       
    End If

Me.SIRA_KOD_NO = Format(Date, "yy") & "-" & Format(GecerliAy, "00") & "-" & Format(GSayimiz, "000")

End If

End Sub
husem, proud to be a member of AccessTr.neT since 08-03-2009.
Son Düzenleme: 04/11/2021, 15:53, Düzenleyen: husem.
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da