- Public SQL As String
- Public Proses As New ClassKoneksi
- Public databelicash As DataTable
- Sub buatKode()
- databelicash = Proses.ExecuteQuery("SELECT cash_kode FROM beli_cash ORDER BY cash_kode DESC")
- If databelicash.Rows.Count = 0 Then
- txtKodeCash.Text = "CS0001"
- Else
- With databelicash.Rows(0)
- txtKodeCash.Text = .Item("cash_kode")
- txtKodeCash.Focus()
- End With
- txtKodeCash.Text = Val(Microsoft.VisualBasic.Mid(txtKodeCash.Text, 3, 4)) + 1
- If Len(txtKodeCash.Text) = 1 Then
- txtKodeCash.Text = "CS000" & txtKodeCash.Text & ""
- ElseIf Len(txtKodeCash.Text) = 2 Then
- txtKodeCash.Text = "CS00" & txtKodeCash.Text & ""
- ElseIf Len(txtKodeCash.Text) = 3 Then
- txtKodeCash.Text = "CS0" & txtKodeCash.Text & ""
- ElseIf Len(txtKodeCash.Text) = 4 Then
- txtKodeCash.Text = "CS" & txtKodeCash.Text & ""
- End If
- End If
- End Sub
Selasa, 10 Maret 2015
Fungsi Membuat Kode Otomatis
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar