D
DS
Is there a better way to do this?
Thamks
DS
Private Sub ImageRemove_Click()
If Me.ListApply.ListCount = 0 Then
DoCmd.OpenForm "NoPayments"
ElseIf IsNull(Me.TxtPayID) Then
DoCmd.OpenForm "NoPaymentSelected"
ElseIf Me.ListApply.ListCount > 0 Then
If Me.TxtTypeID = 9 Then
DoCmd.SetWarnings False
Dim RemoveDepSQL As String
RemoveDepSQL = "UPDATE Deposits SET
[Applied]=False,[UsageDate]=Null " & _
"WHERE Deposits.[DepositID] = Forms!CheckPayment!TxtDepositID "
DoCmd.RunSQL (RemoveDepSQL)
DoCmd.SetWarnings True
DoCmd.SetWarnings False
Dim MySQL As String
MySQL = "DELETE * FROM PayApplied " & _
"WHERE [PaymentID] = " & Me![TxtPayID] & "And [SalesID] = " &
Me![SalesID] & ""
DoCmd.RunSQL (MySQL)
DoCmd.SetWarnings True
Me.ListApply.Requery
Forms!CheckPayment!TxtTotalPayments = Nz(DSum("[PaymentAmount]",
"PayApplied", "SalesID=Forms!CheckPayment!SalesID"), 0)
Else:
DoCmd.SetWarnings False
MySQL = "DELETE * FROM PayApplied " & _
"WHERE [PaymentID] = " & Me![TxtPayID] & "And [SalesID] = " &
Me![SalesID] & ""
DoCmd.RunSQL (MySQL)
DoCmd.SetWarnings True
Me.ListApply.Requery
Forms!CheckPayment!TxtTotalPayments = Nz(DSum("[PaymentAmount]",
"PayApplied", "SalesID=Forms!CheckPayment!SalesID"), 0)
End If
End If
End Sub
Thamks
DS
Private Sub ImageRemove_Click()
If Me.ListApply.ListCount = 0 Then
DoCmd.OpenForm "NoPayments"
ElseIf IsNull(Me.TxtPayID) Then
DoCmd.OpenForm "NoPaymentSelected"
ElseIf Me.ListApply.ListCount > 0 Then
If Me.TxtTypeID = 9 Then
DoCmd.SetWarnings False
Dim RemoveDepSQL As String
RemoveDepSQL = "UPDATE Deposits SET
[Applied]=False,[UsageDate]=Null " & _
"WHERE Deposits.[DepositID] = Forms!CheckPayment!TxtDepositID "
DoCmd.RunSQL (RemoveDepSQL)
DoCmd.SetWarnings True
DoCmd.SetWarnings False
Dim MySQL As String
MySQL = "DELETE * FROM PayApplied " & _
"WHERE [PaymentID] = " & Me![TxtPayID] & "And [SalesID] = " &
Me![SalesID] & ""
DoCmd.RunSQL (MySQL)
DoCmd.SetWarnings True
Me.ListApply.Requery
Forms!CheckPayment!TxtTotalPayments = Nz(DSum("[PaymentAmount]",
"PayApplied", "SalesID=Forms!CheckPayment!SalesID"), 0)
Else:
DoCmd.SetWarnings False
MySQL = "DELETE * FROM PayApplied " & _
"WHERE [PaymentID] = " & Me![TxtPayID] & "And [SalesID] = " &
Me![SalesID] & ""
DoCmd.RunSQL (MySQL)
DoCmd.SetWarnings True
Me.ListApply.Requery
Forms!CheckPayment!TxtTotalPayments = Nz(DSum("[PaymentAmount]",
"PayApplied", "SalesID=Forms!CheckPayment!SalesID"), 0)
End If
End If
End Sub