No botão Debito
Private Sub Comando42_Click()
On Error Resume Next
Dim varItem As Variant
Dim frm As Form, ctl As Control
Set frm = Forms!Debitos
Set ctl = frm!Lista
If MsgBox("Liquidar como Multibanco ? ", vbYesNo + vbQuestion, "Agenda") = vbYes Then
For Each varItem In ctl.ItemsSelected
CurrentDb.Execute "UPDATE Agenda SET Multibanco=" & Me.Lista.Column(4, varItem) & " WHERE IDConsulta = " & Me.Lista.Column(6, varItem) & ";"
CurrentDb.Execute "UPDATE Agenda SET deve='" & 0 & "' WHERE IDConsulta = " & Me.Lista.Column(6, varItem) & ";"
CurrentDb.Execute "UPDATE Agenda SET Paga='" & Me.Comando42.Caption & "' WHERE IDConsulta = " & Me.Lista.Column(6, varItem) & ";"
CurrentDb.Execute "UPDATE Agenda SET DataRecebimento='" & Date & "' WHERE IDConsulta = " & Me.Lista.Column(6, varItem) & ";"
CurrentDb.Execute "UPDATE Agenda SET QuemRecebeu='" & Me.Utilizador & "' WHERE IDConsulta = " & Me.Lista.Column(6, varItem) & ";"
Next varItem
Else
Me.Lista.Selected(varItem) = False
Exit Sub
End If
Me.Lista.Requery
MsgBox "Consulta Liquidada com Sucesso!", vbOKOnly + vbInformation, "Agenda"
Call Form_Load
End Sub
No botão Dinheiro
Private Sub Comando43_Click()
On Error Resume Next
Dim varItem As Variant
Dim frm As Form, ctl As Control
Set frm = Forms!Debitos
Set ctl = frm!Lista
If MsgBox("Liquidar como Dinheiro ? ", vbYesNo + vbQuestion, "Agenda") = vbYes Then
For Each varItem In ctl.ItemsSelected
CurrentDb.Execute "UPDATE Agenda SET Dinheiro=" & Me.Lista.Column(4, varItem) & " WHERE IDConsulta = " & Me.Lista.Column(6, varItem) & ";"
CurrentDb.Execute "UPDATE Agenda SET deve='" & 0 & "' WHERE IDConsulta = " & Me.Lista.Column(6, varItem) & ";"
CurrentDb.Execute "UPDATE Agenda SET Paga='" & Me.Comando43.Caption & "' WHERE IDConsulta = " & Me.Lista.Column(6, varItem) & ";"
CurrentDb.Execute "UPDATE Agenda SET DataRecebimento='" & Date & "' WHERE IDConsulta = " & Me.Lista.Column(6, varItem) & ";"
CurrentDb.Execute "UPDATE Agenda SET QuemRecebeu='" & Me.Utilizador & "' WHERE IDConsulta = " & Me.Lista.Column(6, varItem) & ";"
Next varItem
Else
Exit Sub
End If
Me.Lista.Requery
MsgBox "Consulta Liquidada com Sucesso!", vbOKOnly + vbInformation, "Agenda"
Call Form_Load
End Sub
Bom final de semana...