I have a txt box 'Date Received' in which I use the calendar control to input the date. I also have a combo box 'Priority' and another txt box 'Priority Date'. When I select a value from the combo box it auto fills 'Priority Date'. What I want is when I change the date received txt box I want the code to run again and update the 'Priority Date'. Right now after I enter a date into the date received txt box, select a priority, and then decide to change the date received the code does not automatically run again. I have to reselect the priority cmbbox so that the correct date will show in the priority date.
Here is the code:
Private Sub Priority_Change()
If Priority = "A" Then
Priority_Date = Date_Received + 1
ElseIf Priority = "B" Then
Priority_Date = Date_Received + 3
ElseIf Priority = "C" Then
Priority_Date = Date_Received + 7
ElseIf Priority = "D" Then
Priority_Date = Date_Received + 7
ElseIf Priority = "E" Then
Priority_Date = Date_Received + 14
ElseIf Priority = "O" Then
Status = "A&I"
End If
Private Sub Date_Received_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Show Calendar and set its date.
Calendar.Visible = True
Calendar.SetFocus
'Set to today if Date Received has no value.
Calendar.Value = IIf(IsNull(Date_Received), Date, Date_Received.Value)
End Sub
Private Sub Calendar_Click()
Date_Received.Value = Calendar.Value
Date_Received.SetFocus
Calendar.Visible = False
End Sub
Private Sub Calendar2_Click()
Date_Customer_up.Value = Calendar2.Value
Date_Customer_up.SetFocus
Calendar2.Visible = False
End Sub
Private Sub Date_Customer_up_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
' Show Calendar and set its date.
Calendar2.Visible = True
Calendar2.SetFocus
' Set to today if Date Customer Up has no value.
Calendar2.Value = IIf(IsNull(Date_Customer_up), Date, Date_Customer_up.Value)
End Sub
Any help would be appreciated!
Here is the code:
Private Sub Priority_Change()
If Priority = "A" Then
Priority_Date = Date_Received + 1
ElseIf Priority = "B" Then
Priority_Date = Date_Received + 3
ElseIf Priority = "C" Then
Priority_Date = Date_Received + 7
ElseIf Priority = "D" Then
Priority_Date = Date_Received + 7
ElseIf Priority = "E" Then
Priority_Date = Date_Received + 14
ElseIf Priority = "O" Then
Status = "A&I"
End If
Private Sub Date_Received_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Show Calendar and set its date.
Calendar.Visible = True
Calendar.SetFocus
'Set to today if Date Received has no value.
Calendar.Value = IIf(IsNull(Date_Received), Date, Date_Received.Value)
End Sub
Private Sub Calendar_Click()
Date_Received.Value = Calendar.Value
Date_Received.SetFocus
Calendar.Visible = False
End Sub
Private Sub Calendar2_Click()
Date_Customer_up.Value = Calendar2.Value
Date_Customer_up.SetFocus
Calendar2.Visible = False
End Sub
Private Sub Date_Customer_up_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
' Show Calendar and set its date.
Calendar2.Visible = True
Calendar2.SetFocus
' Set to today if Date Customer Up has no value.
Calendar2.Value = IIf(IsNull(Date_Customer_up), Date, Date_Customer_up.Value)
End Sub
Any help would be appreciated!