Kalau nilai awal N diisi 1 bagaimana?
If AdoNoUrut.RecordCount = 0 Then
N = 1
Else
AdoNoUrut.MoveLast
N = AdoNoUrut.Fields("N")
End If
N = N + 1
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED]
On Behalf Of mukromin
Sent: Monday, April 30, 2007 10:24 AM
To: [email protected]; [EMAIL PROTECTED]
Subject: [indoprog-vb] Nomor Otomatis
Selamat pagi rekan-rekan semua, saya punya koding seperti dibawah.
Sub NoUrut()
Set AdoNoUrut = New Recordset
AdoNoUrut.Open "Select Left(Max(tblIn.In_Id),4) As N from tblIn", db,
adOpenStatic, adLockOptimistic
If AdoNoUrut.RecordCount = 0 Then
N = 0
Else
AdoNoUrut.MoveLast
N = AdoNoUrut.Fields("N")
End If
N = N + 1
txtNomor.Text = Format(N, "0000") & "-" & Format(Now, "MMM-yy") & ("-" &
"IN" )
End Sub
Private Sub cmdAdd_Click()
Call NoUrut
End Sub
Pada saat cmdAdd diclick nomor otomatis urut ( N + 1 ). Masalahnya jika
tblIn masih kosong nomor tidak otomatis
menjadi 1. Untuk nomor ke 2 dst tidak masalah. Mohon pencerahannya.
Terima Kasih
Salam
Mukromin
[Non-text portions of this message have been removed]
----------
This email is confidential. If you are not the addressee tell the sender
immediately and destroy this email
without using, sending or storing it. Emails are not secure and may suffer
errors, viruses, delay,
interception and amendment. Standard Chartered PLC and subsidiaries ("SCGroup")
do not accept liability for
damage caused by this email and may monitor email traffic.
[Non-text portions of this message have been removed]