Mungkin saya bsa bantuin juga,
--Untuk koneksi Database call aja dari function
Connect

Dim rs as ADODB.Recordset
Function BuatKode_Trans()
On Error Resume Next
Dim dd As String
Dim yy As String
Dim sql As String
Dim tekskode, kode
dd = Format(Date, "MM")
yy = Year(Date)
Set rs = New ADODB.Recordset
sql = "SELECT * FROM bla bla bla"
rs.Open sql, StrConnection, adOpenDynamic,
adLockOptimistic
If Not rs.EOF Then
    rs.MoveLast
    tekskode = rs(0)
    kode = tekskode + 1
    txt_kode.Text = yy & dd & Mid(kode, 7, 5)
Else
txt_kode.Text = dd & yy & "001"
 End If
If Mid(rs.Fields(0).Value, 1, 4) <> yy Then
      txt_kode.Text = dd & yy & "001"
 End If
End Sub

Function ini 

--- Heru Rahadyan <[EMAIL PROTECTED]> wrote:
> mungkin ini bisa bantu,
>  
> Urut = Nilai + 1
> KodeTrans= format(now,"yyyymmdd") + cstr(urut)
>  
> note:
> - utk tgl bln tahun, sebaiknya pake format thn bln
> tgl biar gampang
> sortingnya
> - utk nilai, tergantung data mana yg jd patokan.
> bisa dr data base (jadi
> buat quey dulu buat baca database), dr txt file, dr
> urutan yg disimpan
> di memory dll. jadi dioleh dulu di fungsi nilai
>  
> function Nilai ()
>     X = ????
>     Nilai = X + 1
> end function
>  
>  
> -----Original Message-----
> From: [email protected]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> dYATH f2v
> Sent: Friday, April 15, 2005 12:20 PM
> To: [email protected]
> Subject: [Programmer-VB] Membuat Kode Trans
> Otomatis...
> 
> 
> Salam kenal buat semuanya....
>  
> saya buat program penjualan yang menggunakan kode
> transaksi...
> tapi saya ingin kode trans nya tidak diisi manual
> tetapi otomatis ketika
> tombol NewTrans di klik,,,, dan kode trans nya
> terdiri dari 9 digit
> yaitu tgl, bulan dan tahun di komputer (pada saat
> terjadi transaksi) dan
> diikuti 3 digit dibelakang sebagai kode trans nya
>  mohon bantuan para programmer semua....
>  
> Tanx 
>  
> rgd
>  
> dyt
> 
> 
>   _____  
> 
> Do you Yahoo!?
> Yahoo! Small Business - Try
>
<http://us.rd.yahoo.com/evt=31637/*http://smallbusiness.yahoo.com/resour
> ces/> our new resources site! 
> 
> Untuk keluar dari millis ini, kirim email kosong ke:
> [EMAIL PROTECTED]
> 
> 
> 
> 
> 
>   _____  
> 
> Yahoo! Groups Links
> 
> 
> *     To visit your group on the web, go to:
> http://groups.yahoo.com/group/programmer-vb/
>   
> 
> *     To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
>
<mailto:[EMAIL PROTECTED]>
> 
>   
> 
> *     Your use of Yahoo! Groups is subject to the Yahoo!
> Terms of
> Service <http://docs.yahoo.com/info/terms/> . 
> 
> 
> 
>   _____  
> 
>
<-----------------------------------------------------------------------
> ----> 
> 
> 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Untuk keluar dari millis ini, kirim email kosong ke:
[EMAIL PROTECTED]

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/programmer-vb/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Kirim email ke