berikut source code nya :
Function autoNumber() As String
Dim rs As New ADODB.Recordset
rs.Open "select max(kode_beli) from pembelian where month(tgl_beli)=" & Month(Now) & _
" and year(tgl_beli)=" & Year(Now), cn
autoNumber = IIf(IsNull(rs.Fields(0)), Right(Year(Now), 2) & Month(Now) & "001", _
Left(rs.Fields(0), 4) & Format(Right(rs.Fields(0), 3) + 1, "0##"))
rs.Close
End Function
berikut screenshootnya :
No comments:
Post a Comment