Code:
Private Sub CmdPostPayment_Click()
Dim strsql As String
Dim db As DAO.Database
Set db = CurrentDb
If Me.IsPayrollDeduct = False Then
strsql = "INSERT INTO tblAccountLedger (TransactionID, TransTypeID, TransCode, TransDate, AccountID, DescriptionID, TransMethodID, Debit) " & _
"VALUES (" & TransactionID & ", " & CboTransType & ", '" & TransCode & "', #" & TransDate & "#, " & CboFromAccount & ", " & DescriptionID & ", " & CboTransMethod & ", " & TransAmount & ")"
Debug.Print strsql
db.Execute strsql, dbFailOnError
strsql = "INSERT INTO tblAccountLedger (TransactionID, TransTypeID, TransCode, TransDate, AccountID, DescriptionID, TransMethodID, Credit) " & _
"VALUES (" & TransactionID & ", " & CboTransType & ", '" & TransCode & "', #" & TransDate & "#, " & CboToAccount & ", " & DescriptionID & ", " & CboTransMethod & ", " & TransAmount & ")"
Debug.Print strsql
db.Execute strsql, dbFailOnError
Else
strsql = "INSERT INTO tblAccountLedger (TransactionID, TransTypeID, TransCode, TransDate, AccountID, DescriptionID, TransMethodID, Credit) " & _
"VALUES (" & TransactionID & ", " & CboTransType & ", '" & TransCode & "', #" & TransDate & "#, " & CboToAccount & ", " & DescriptionID & ", " & CboTransMethod & ", " & TransAmount & ")"
Debug.Print strsql
db.Execute strsql, dbFailOnError
End If
Me.IsPaid = True
CurrentDb.Execute "UPDATE tblTransBillLedger SET IsPaid = True WHERE TransBillID=" & Forms!frmTransPayment!TransBillID
db.Execute strsql, dbFailOnError
Me.RecordLock = True
Call Form_Current
End Sub