Aya Göre Otomatik Numara Verdirme - Baskı Önizleme +- AccessTr.neT (https://accesstr.net) +-- Forum: Microsoft Access (https://accesstr.net/forum-microsoft-access.html) +--- Forum: Access Cevaplanmış Soruları (https://accesstr.net/forum-access-cevaplanmis-sorulari.html) +--- Konu Başlığı: Aya Göre Otomatik Numara Verdirme (/konu-aya-gore-otomatik-numara-verdirme.html) Sayfalar:
1
2
|
RE: Aya Göre Otomatik Numara Verdirme - husem - 04/11/2021 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 |