Terima kasih untuk Ibu/Bpk BO
Kodenya mantep
Namun ada eror jika kode itu untuk create nomor pertama jadi saya tambahkan
saja konsep dcount seperti kemarin berikut kodenya
Private Sub Command16_Click()
On Error Resume Next
DoCmd.GoToRecord , , acNewRec
If DCount("suplyer_id", "t_suplyer", "[suplyer_id]" <> "") > 0 Then
Txt_Suplyer_ID = S_ID
Else
Txt_Suplyer_ID = s_id_pertama
End If
End Sub
Function S_ID() As String
S_ID = "S" & Format(CInt(Right(DLast("Suplyer_ID", "T_Suplyer"), 3)) + 1,
"000")
End Function
Function s_id_pertama() As String
x = DCount("suplyer_id", "t_suplyer", "[suplyer_id]" <> "") + 1
XY = "S" & Format(x, "000")
s_id_pertama = XY
End Function
Untuk selanjutnya saya sepertinya akan banyak bertanya nich
Thx
Yokanan
_____
From: [email protected] [mailto:[email protected]]
On Behalf Of Belajar Office
Sent: Tuesday, February 16, 2010 1:52 PM
To: [email protected]
Subject: Re: [belajar-access] Formula Dcount,membuat nomor document
Bpk, procedure:
Function S_ID() As String
x = DCount("Suplyer_id", "t_suplyer", "[suplyer_id]" <> "") + 1
xY = "S" & Format(x, "000")
S_ID = xY
End Function
Diubah menjadi:
Function S_ID() As String
S_ID = "S" & Format(CInt(Right(DLast("Suplyer_ID", "T_Suplyer"), 3)) + 1,
"000")
End Function
Thank's
----- Original Message -----
From: yokananwahyono <mailto:[email protected]>
To: belajar-access@ <mailto:[email protected]> yahoogroups.com
Sent: Tuesday, 16 February 2010 11:35 AM
Subject: [belajar-access] Formula Dcount,membuat nomor document [1
Attachment]
Dear Teman - teman acces
Saya mau mencoba membuat program PO
Membuat Supliyer_id dengan formula dcount seperti yang di berikan dari teman
- teman kmrn
Tetapi kalau kita pernah del salah satu supliyer maka hasil formula dcount
akan salah
Padahal untuk suplyer id saya buat primary key
Kira - kira gmn solusinya
Thx
Yokanan