Revisi, penomoran hanya untuk new record saja.
Fungsi getno saya buat lebih sederhana step by step-nya untuk mudah dipahami:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If ("" & Me.TBayar) = "" Or Not IsDate(Me.TBayar) Then
Beep
Me.TBayar.SetFocus
Cancel = -1
Exit Sub
End If
If Me.NewRecord Then Me.NoKwt = GetNo
End Sub
Private Function GetNo() As String
Dim strNomor As String, intNomor As Integer, strBulan As String, strTahun As String
strNomor = DMax("Left(NoKwt,4)", "TBLKwt")
intNomor = Val(Nz(strNomor, 0))
strBulan = Choose(Month(Me.TBayar), "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII")
strTahun = Format(Me.TBayar, "yy")
GetNo = Format(intNomor + 1, "0000") & "/KP-KU/" & strBulan & "/" & strTahun
End Function
Aksan Kurdin
On 3/21/2011 3:00 PM, Aksan Kurdin wrote:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If ("" & Me.TBayar) = "" Or Not IsDate(Me.TBayar) Then
Beep
Me.TBayar.SetFocus
Cancel = -1
Exit Sub
End If
Me.NoKwt = GetNo
End Sub
Private Function GetNo() As String
GetNo = Format(Val(Nz(DMax("Left(NoKwt,4)", "TBLKwt"), 0)) + 1, "0000") & "/KP-KU/" & Choose(Month(Me.TBayar), "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII") & "/" & Format(Me.TBayar, "yy")
End Function
aksan kurdin
On 3/21/2011 10:19 AM, Aksan Kurdin wrote:apa arti penomoran tersebut sperti ini?
0001 : urut
KP-KU : statis, tidak berubah
XI : bulan ?
11: tahun ?
aksan kurdin
On 3/21/2011 9:49 AM, Sutrisno Ae wrote:dear mas pak aksan
pak bagaimana kalau untuk membuat fungi nomor otomatisnya seperti format berikut.
0001/KP-KU/XI/11, bagaimana pak..?
salam,
From: Aksan Kurdin <aksan.kurdin@gmail.com>
To: belajar-access@yahoogroups.com
Sent: Fri, March 18, 2011 9:25:15 AM
Subject: Re: [belajar-access] Re: No Transaksi otomatis
Katanya 1 gambar seribu kata-kata:
Aksan Kurdin
On 3/18/2011 8:55 AM, Sutrisno Ae wrote:Pak Akhsan
bisa ngasih contoh yang lebih detail ga, maklum lagi belajar neh
thx
From: aksankurdin <aksan.kurdin@gmail.com>
To: belajar-access@yahoogroups.com
Sent: Fri, March 18, 2011 4:18:08 AM
Subject: [belajar-access] Re: No Transaksi otomatis
Letakkan fungsi untuk mengambil nomor baru di event before update dari form tersebut.
Pseude code seperti ini:
if me.newrecord then
fieldNomor = AmbilNomorBaru()
endif
Aksan Kurdin
--- In belajar-access@yahoogroups.com, Hendra Agestha Hamid <the_agestha@...> wrote:
>
> Dear mas Trisnoe..
>
> Kalo saya pake fungsi Iif, bisa dibuat di Query contoh :
>
> Kode: IIf([JurKelas]="",[JenjPend_NL] & "/" & [Kelas_NL] & "." &
> [SubKelas_NL],[JenjPend_NL] & "/" & [Kelas_NL] & "." & [JurKelas] & "." &
> [SubKelas_NL])
>
> atau :
>
> KodeKls: IIf([AutoNumbKK]<10,"KK0" & [AutoNumbKK],"KK" & [AutoNumbKK])
>
> Cuma saya belum tahu gimana caranya supaya contoh2 field diatas otomatis menjadi
> Primary Key, sebenarnya tau Cuma blm pernah saya praktekkan yaitu dengan "Query
> Make Table".
> Karena msh males nyoba "Query Make Table" itu (...) maka saya bikin contoh2 di
> atas pada unbound text box, kemudian operator tinggal mengetikkan isinya ke
> sebuah field yg kita set sbg PK.
> Saya yakin Suhu2 Access punya jurus yg lebih canggih.
>
> Regards
> Hendra
>
>
>
> ________________________________
> From: Soetrisno <trisno_ae@...>
> To: belajar-access@yahoogroups.com
> Sent: Thu, March 17, 2011 5:38:20 PM
> Subject: [belajar-access] No Transaksi otomatis
>
>
> salam kenal
> para master access
>
> mohon pencerahannya, bagaimana cara membuat no transaksi otomatis, pada saat
> menambah data baru pada form transaksi no tersebut akan muncul secara otomatis.
> contoh: 001/AB-CD/VI/11,
>
> terima kasih
>
> salam,
>
> trisnoe
>
__._,_.___
No comments:
Post a Comment