I have code to make autonumber with date format....
I want every date change the number back to "0001" ..Code:Call koneksi() cmd = New OleDbCommand("select * from penjualan order by no_faktur desc", conn) dr = cmd.ExecuteReader dr.Read() If Not dr.HasRows Then penfaktur.Text = "" + Format(Now, "ddMMyyyy") + "NF" + "0001" Else penfaktur.Text = Val(Microsoft.VisualBasic.Mid(dr.Item("no_faktur").ToString, 11, 4)) + 1 If Len(penfaktur.Text) = 1 Then penfaktur.Text = "" + Format(Now, "ddMMyyyy") + "NF000" & penfaktur.Text & "" ElseIf Len(penfaktur.Text) = 2 Then penfaktur.Text = "" + Format(Now, "ddMMyyyy") + "NF00" & penfaktur.Text & "" ElseIf Len(penfaktur.Text) = 3 Then penfaktur.Text = "" + Format(Now, "ddMMyyyy") + "NF0" & penfaktur.Text & "" ElseIf Len(penfaktur.Text) = 4 Then penfaktur.Text = "" + Format(Now, "ddMMyyyy") + "NF" & penfaktur.Text & "" End If End If
help me..




Reply With Quote
