Ini ada contoh source yang ada minta, semoga bermamfaat


----- Original Message ----
From: kislew_mm <[EMAIL PROTECTED]>
To: [email protected]
Sent: Thursday, May 3, 2007 7:08:18 PM
Subject: [indoprog-vb] Re: Penomoran urut

--- In indoprog-vb@ yahoogroups. com, McBoenBoen <[EMAIL PROTECTED] .> wrote:
>
> Dear All,
> 
> Tolong pencerahannya. ...
> saya mau sistim penomoran otomatis, tapi ada kendala sedikit
> bagaimana caranya supaya penomoran yang didepannya ada karakter 
bisa terus berlanjut
> misalnya : TM60001
> TM60002, dst....
> 
> codingnya spt ini
> Private Sub sp_nobaru()
> Dim rsnokel As New ADODB.Recordset
> Dim snokel As String, nobaru As String
> Set rsnokel = New ADODB.Recordset
> 
> rsnokel.Open "Select no_urut from trx_dompet_drop order by 
no_urut", cn, adOpenDynamic, adLockOptimistic
> If rsnokel.RecordCount = 0 Then
> nobaru = "TM60001"
> Else
> rsnokel.MoveLast
> snokel = rsnokel!no_urut + 1 <====== DISINI ERORNYA
> nobaru = Left("TM6000" , 6 - Len(snokel)) & snokel

'=========== ========= ========= =====

snokel type String, jadi error krn type data.
coba ubah jadi, pisahin prefix dan angka/nilai.
saya anggap "TM6" adalah prefix, dan nilainya "0001"

prefix = Left(rsnokel! no_urut, 3)
Nilai = Trim(Mid(rsnokel! no_urut, 4, 7 )) <- angka 7 blh ganti len
( rsnokel!no_urut )

Dim X As Double
X = Val(Nilai) + 1

'jika record sudah mencapai limit Exit program.
If X = 9999 Then
MsgBox "Data telah mencapai Limit 9.999, Tidak bisa 
menambah record lagi, terima kasih"
End
End If

nobaru = prefix + Format(CStr( X), "0000")
txtnourut.Text = nobaru

'=========== ========= ========= ========

good luck..:)

> 
> End If
> txtnourut.Text = "TM" + nobaru
> rsnokel.Close
> Set rsnokel = Nothing
> End Sub
> 
> kalau untk ngimpannya sudah bisa, cuma kalau mau bikin nomor 
selanjutnya error
> 
> thxb4
> mc
> 
> 
> ------------ --------- --------- ---
> Ahhh...imagining that irresistible "new car" smell?
> Check outnew cars at Yahoo! Autos.
> 
> [Non-text portions of this message have been removed]
>




Send instant messages to your online friends http://uk.messenger.yahoo.com 

[Non-text portions of this message have been removed]

Kirim email ke