Yodelayheewho
Member
I have a userform and the following code notifies users if the sales proposal is current or expired. It works fine. Once the order is completed, I don't want these messages to keep popping up. So I need to add a condition based on the value (stage) in a combo box.
I want the messages to be 'disabled' if the stage selected in the combo box is Completed or Canceled.
txtExpDate = expiration date (proposal date + 60 days)
txtPropDate = proposal date
txtPORecDate = PO received date
cboStage = combo box list: Waiting to Process, Waiting for PO, Waiting Approval, Standby Completed, Canceled
I've been wrestling with this and no luck. I'm still new to VBA.
Thank you in advance for your consideration.
I want the messages to be 'disabled' if the stage selected in the combo box is Completed or Canceled.
txtExpDate = expiration date (proposal date + 60 days)
txtPropDate = proposal date
txtPORecDate = PO received date
cboStage = combo box list: Waiting to Process, Waiting for PO, Waiting Approval, Standby Completed, Canceled
I've been wrestling with this and no luck. I'm still new to VBA.
Thank you in advance for your consideration.
Code:
'***Expiration Date***
Dim x As Date
Dim y As Date
If IsDate(DateValue(txtPropDate.Value)) Then
txtExpDate.Value = DateValue(txtPropDate.Value) + (60)
txtExpDate.Enabled = False
x = DateValue(txtPropDate.Value) + (60)
y = DateValue(txtPORecDate.Value)
With txtExpDate
If x < y Then
MsgBox "This proposal is expired. Requires management approval or an updated proposal."
txtExpDate.BackColor = vbYellow
ElseIf x >= y Then
MsgBox "This proposal is current. Proceed with order entry."
.BackColor = 12648384
End If
End With
End If