|
Kebetulan aku punya contoh coding-nya. Moga’’
bener yah jawabannya. J ***pertama cek dulu ke table, max
value dari table tersebut *** ssql = " select
max(substring(custid,6,3)) as no_akhir from TRInfoCust" ssql = ssql & " where usr_id
= '" & usr_id & "' and left(custid,5) = '" &
Text1(0).Text & "'" With rs If .State = adStateOpen Then
.Close Set .DataSource = Nothing '.CursorLocation = adUseClient .Open ssql, con, 3, 3, 1 ***pertama cek jumlah record, jika
0 maka set ke angka awal, jika lebih dari 0 maka angka tersebut ditambah satu***
If .RecordCount > 0 And
(.fields("no_akhir")) <> "" Then no_urut_2 =
CStr(CDbl(.fields("no_akhir")) + 1) If Len(no_urut_2) = 1 Then no_urut_2 = "00"
& no_urut_2 End If If Len(no_urut_2) = 2 Then no_urut_2 = "0"
& no_urut_2 End If If Len(no_urut_2) = 3 Then no_urut_2 = no_urut_2 End If Else no_urut_2 = "001" End If Text1(25).Text = no_urut_2 End With Best Regards, Layong Lim PT. Indomobil Trada
Nasional Jl. M.T Haryono Kav. 9 WIM II Lantai 3 ' 021-8569117 Ext : 1302 ' 0815-8800-705 ' 021-8564864 (Fax) From:
[email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Achmad Dear All, Saya ingin membuat auto number di textbox berdasarkan nomor
terakhir dlm kolom di tabel. Dengan option sbb: 1--> 1.10.xxxx 2--> 2.30.xxxx ket: xxxx --> adalah auto number cth: saya pilih option no 1. Nomor terakhir dlm tabel adalah
1.10.0005. Jadi auto number dlm textbox --> 1.10.0006 Thx sebelumnya.
|
- RE: [Programmer-VB] Auto number di textbox Layong
- RE: [Programmer-VB] Auto number di textbox Sistyo Alfan Tribowo
- Re: [Programmer-VB] Auto number di textbox Haris Aris
