Saya coba ganti Memakai Konsep Recordset
Tapi tetap ada error di function PDP_Pertama
Dim rst As Recordset
Dim lihat_transaksi As Variant
Dim jumlah_debit As Currency
Set rst = CurrentDb.OpenRecordset("General_Ledger")
lihat_transaksi = DLookup("[transaksion_id]", "[general_ledger]",
"Cstr(Left([transaksion_id], 3) = ' " & PDP & " ' )")
If lihat_transaksi > 0 Then
rst!transaksion_id = NOPDP
Else
rst!transaksion_id = PDP_PERTAMA
End If
rst!GL_Number = DLookup("[GL_Number]", "[po_pd_posting]", "[ID] = 1")
rst!GL_Description = DLookup("[GL_description]", "[po_pd_posting]",
"[ID]=1")
rst!Date = Now
rst!posting = Me.PO_Number
rst!posting_to = Me.PO_Suplyer_ID
rst!Description = "down payment" & Me.PO_Number
jumlah_debit = "Select sum([down_payment]) from po_line where po_number = "
& Me.PO_Number & " "
rst!Value = jumlah_debit
End Sub
Function PDP_PERTAMA() As String
x = DCount("[transaksion_id]", "[general_ledger]",
"Cstr(Left([transaksion_id])=' " & PRD & " ') < "" ") + 1
xy = "PDP" & Format(x, "000")
PRD_PERTAMA = xy
End Function
Function NOPDP() As String
NOPDP = "PDP" & Format(CStr(Right(DLast("transaksion_id", "general_ledger",
[left([transaksion_id],3=' " & PDP & " ')]), 3)) + 1, "000")
End Function
Kira - kira apa yang salah dengan kode saya di atas
Salam
Yokanan wahyono