J
Joe Cilinceon
I've been messing with this for hours now and can't seem to locate the
problem. Please help
Private Sub PostThePayment_Click()
On Error GoTo Err_PostThePayment_Click
Dim tmpCreditEarned As Integer
Dim tmpCreditReason As String
Dim tmpBalanceDue As Integer
Dim strSQL As String
If PaymentAmount > 0 Then
If Me.PaymentAmount > Me.TOTALOWED Then
tmpCreditEarned = Me.PaymentAmount - Me.TOTALOWED
tmpCreditReason = "Over Paid"
ElseIf Me.PaymentAmount < Me.TOTALOWED Then
tmpBalanceDue = Me.TOTALOWED - Me.PaymentAmount
Else
tmpCreditEarned = 0
tmpBalanceDue = 0
tmpCreditReason = Null
End If
strSQL = "UPDATE tblTenantLedger SET tblTenantLedger.CustNo = " &
Me!CustNo
strSQL = strSQL & ", tblTenantLedger.Unit = " & Me!Unit
strSQL = strSQL & ", tblTenantLedger.RentRate = " & Me!txtRentRate
strSQL = strSQL & ", tblTenantLedger.[Payment Date] = #" & Date &
"#"
strSQL = strSQL & ", tblTenantLedger.[Payment Amount] = " &
Me!PaymentAmount
strSQL = strSQL & ", tblTenantLedger.PaymentMethod = '" &
Me!cboPaymentMethod & "'"
strSQL = strSQL & ", tblTenantLedger.Tracking = '" &
Me!TrackingNumber & "'"
strSQL = strSQL & ", tblTenantLedger.PaidFrom = #" & Me!NewPaidFrom
& "#"
strSQL = strSQL & ", tblTenantLedger.PaidThru = #" & Me!txtPaidThru
& "#"
strSQL = strSQL & ", tblTenantLedger.Rent = " & Me!TOTALRENTOWED
strSQL = strSQL & ", tblTenantLedger.Administrationfee = " &
Me!AdmFee
strSQL = strSQL & ", tblTenantLedger.Lock = " & Me!PurLock
strSQL = strSQL & ", tblTenantLedger.LateFees = " & Me!txtLateFees
strSQL = strSQL & ", tblTenantLedger.NSFCheckFee = " & Me!PayNSFFee
strSQL = strSQL & ", tblTenantLedger.LockCutFee = " & Me!txtLockCut
strSQL = strSQL & ", tblTenantLedger.AuctionFee = " & Me!AuctionFee
strSQL = strSQL & ", tblTenantLedger.MiscChg = " & Me!MiscChgs
strSQL = strSQL & ", tblTenantLedger.MiscChgDesc = '" & Me!Combo116
& "'"
strSQL = strSQL & ", tblTenantLedger.Waved = " & Me!WavedAmt
strSQL = strSQL & ", tblTenantLedger.RentAllowance = " &
Me!RENTALLOWENCE
strSQL = strSQL & ", tblTenantLedger.RentAllReason = '" &
Me!Combo118 & "'"
strSQL = strSQL & ", tblTenantLedger.CreditApplied = " &
Me!CreditsApp
strSQL = strSQL & ", tblTenantLedger.CreditEarned = " &
tmpCreditEarned
strSQL = strSQL & ", tblTenantLedger.CreditReason = '" &
tmpCreditReason & "'"
strSQL = strSQL & ", tblTenantLedger.PreviousBalDue = " & Me!PrevBal
strSQL = strSQL & ", tblTenantLedger.BalanceDue = " & tmpBalanceDue
strSQL = strSQL & ", tblTenantLedger.Notes = '" & Me!Notes & "';"
' MsgBox strSQL
' DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
' DoCmd.SetWarnings True
End If
Exit_PostThePayment_Click:
Exit Sub
Err_PostThePayment_Click:
MsgBox Err.Description
Resume Exit_PostThePayment_Click
End Sub
problem. Please help
Private Sub PostThePayment_Click()
On Error GoTo Err_PostThePayment_Click
Dim tmpCreditEarned As Integer
Dim tmpCreditReason As String
Dim tmpBalanceDue As Integer
Dim strSQL As String
If PaymentAmount > 0 Then
If Me.PaymentAmount > Me.TOTALOWED Then
tmpCreditEarned = Me.PaymentAmount - Me.TOTALOWED
tmpCreditReason = "Over Paid"
ElseIf Me.PaymentAmount < Me.TOTALOWED Then
tmpBalanceDue = Me.TOTALOWED - Me.PaymentAmount
Else
tmpCreditEarned = 0
tmpBalanceDue = 0
tmpCreditReason = Null
End If
strSQL = "UPDATE tblTenantLedger SET tblTenantLedger.CustNo = " &
Me!CustNo
strSQL = strSQL & ", tblTenantLedger.Unit = " & Me!Unit
strSQL = strSQL & ", tblTenantLedger.RentRate = " & Me!txtRentRate
strSQL = strSQL & ", tblTenantLedger.[Payment Date] = #" & Date &
"#"
strSQL = strSQL & ", tblTenantLedger.[Payment Amount] = " &
Me!PaymentAmount
strSQL = strSQL & ", tblTenantLedger.PaymentMethod = '" &
Me!cboPaymentMethod & "'"
strSQL = strSQL & ", tblTenantLedger.Tracking = '" &
Me!TrackingNumber & "'"
strSQL = strSQL & ", tblTenantLedger.PaidFrom = #" & Me!NewPaidFrom
& "#"
strSQL = strSQL & ", tblTenantLedger.PaidThru = #" & Me!txtPaidThru
& "#"
strSQL = strSQL & ", tblTenantLedger.Rent = " & Me!TOTALRENTOWED
strSQL = strSQL & ", tblTenantLedger.Administrationfee = " &
Me!AdmFee
strSQL = strSQL & ", tblTenantLedger.Lock = " & Me!PurLock
strSQL = strSQL & ", tblTenantLedger.LateFees = " & Me!txtLateFees
strSQL = strSQL & ", tblTenantLedger.NSFCheckFee = " & Me!PayNSFFee
strSQL = strSQL & ", tblTenantLedger.LockCutFee = " & Me!txtLockCut
strSQL = strSQL & ", tblTenantLedger.AuctionFee = " & Me!AuctionFee
strSQL = strSQL & ", tblTenantLedger.MiscChg = " & Me!MiscChgs
strSQL = strSQL & ", tblTenantLedger.MiscChgDesc = '" & Me!Combo116
& "'"
strSQL = strSQL & ", tblTenantLedger.Waved = " & Me!WavedAmt
strSQL = strSQL & ", tblTenantLedger.RentAllowance = " &
Me!RENTALLOWENCE
strSQL = strSQL & ", tblTenantLedger.RentAllReason = '" &
Me!Combo118 & "'"
strSQL = strSQL & ", tblTenantLedger.CreditApplied = " &
Me!CreditsApp
strSQL = strSQL & ", tblTenantLedger.CreditEarned = " &
tmpCreditEarned
strSQL = strSQL & ", tblTenantLedger.CreditReason = '" &
tmpCreditReason & "'"
strSQL = strSQL & ", tblTenantLedger.PreviousBalDue = " & Me!PrevBal
strSQL = strSQL & ", tblTenantLedger.BalanceDue = " & tmpBalanceDue
strSQL = strSQL & ", tblTenantLedger.Notes = '" & Me!Notes & "';"
' MsgBox strSQL
' DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
' DoCmd.SetWarnings True
End If
Exit_PostThePayment_Click:
Exit Sub
Err_PostThePayment_Click:
MsgBox Err.Description
Resume Exit_PostThePayment_Click
End Sub