excluir registros listbox comparando datas
Enviado: 16 Set 2018 às 22:54
ola... td bem?!?!?! posso contar com a preciosa ajuda de vcs????
tenho um form com botao excluir que preciso adaptar uma condicao comparando datas e somar numero de dia para definir o criterio de exclusao: garantia de 90 dias dos produtos vendidos;
preciso excluir todos os produtos(registros) do listbox/planilha que ultrapassaram a data da venda + 90 dias, ou seja: textboxdtVenda (dt venda) + 90 > label_dtAtual (hoje) = exclur;
lembrando que a textbox_dtVenda tmb recebe valor vazio("") ate que ocorra o fato da venda do produto; a label_dtAtual ta no inicialize...
tentei fazer com loop(for, while...), mas nao consegui fazer rodar dejeito nenhum!
segue codigo atual:
Public geral As ListObject
Public registros As ListRow
Private Sub CommandButton_Excluir_Click()
If EnableEvents = False Then Exit Sub
Call desproteger
Set registros = geral.ListRows(Me.ListBoxTabGeral.ListIndex + 1)
If Me.TextBoxDtVenda = "" Then
MsgBox "Disponível. Venda não concretizada!", vbCritical, "Atenção!!!"
Me.ListBoxTabGeral.ListIndex = -1
Exit Sub
End If
Dim resp As Integer
resp = MsgBox("Confirma a exclusão: " & UCase(TextBoxVeiculo.Value) & "_" & UCase(TextBoxAno.Value) & "_" & UCase(TextBoxPlaca.Value),
vbYesNo, "Excluir!")
If resp = vbYes Then
registros.Delete
End If
If resp = vbNo Then
Exit Sub
End If
Me.ListBoxTabGeral.ListIndex = -1
Call limparCampos
Set geral = Plan1.ListObjects("TabGeral")
Call proteger
End Sub
conto com apoio! obrigado.
tenho um form com botao excluir que preciso adaptar uma condicao comparando datas e somar numero de dia para definir o criterio de exclusao: garantia de 90 dias dos produtos vendidos;
preciso excluir todos os produtos(registros) do listbox/planilha que ultrapassaram a data da venda + 90 dias, ou seja: textboxdtVenda (dt venda) + 90 > label_dtAtual (hoje) = exclur;
lembrando que a textbox_dtVenda tmb recebe valor vazio("") ate que ocorra o fato da venda do produto; a label_dtAtual ta no inicialize...
tentei fazer com loop(for, while...), mas nao consegui fazer rodar dejeito nenhum!
segue codigo atual:
Public geral As ListObject
Public registros As ListRow
Private Sub CommandButton_Excluir_Click()
If EnableEvents = False Then Exit Sub
Call desproteger
Set registros = geral.ListRows(Me.ListBoxTabGeral.ListIndex + 1)
If Me.TextBoxDtVenda = "" Then
MsgBox "Disponível. Venda não concretizada!", vbCritical, "Atenção!!!"
Me.ListBoxTabGeral.ListIndex = -1
Exit Sub
End If
Dim resp As Integer
resp = MsgBox("Confirma a exclusão: " & UCase(TextBoxVeiculo.Value) & "_" & UCase(TextBoxAno.Value) & "_" & UCase(TextBoxPlaca.Value),
vbYesNo, "Excluir!")
If resp = vbYes Then
registros.Delete
End If
If resp = vbNo Then
Exit Sub
End If
Me.ListBoxTabGeral.ListIndex = -1
Call limparCampos
Set geral = Plan1.ListObjects("TabGeral")
Call proteger
End Sub
conto com apoio! obrigado.