ivonsurf123
Registered User.
- Local time
- Yesterday, 18:28
- Joined
- Dec 8, 2017
- Messages
- 69
Hello,
I am trying to disable save button when the cboYear is not <> currentYear,
right now the code I have is disabling all the years including the current year when I filter the cboYear, Do I need to add this code somewhere else like on Load or Current? Or Am I missing something else? Please Help. Thank you.
I am trying to disable save button when the cboYear is not <> currentYear,
right now the code I have is disabling all the years including the current year when I filter the cboYear, Do I need to add this code somewhere else like on Load or Current? Or Am I missing something else? Please Help. Thank you.
Code:
Private Sub cboYear_AfterUpdate()
Dim myDate
myDate = Year(Date)
If (Me.cboYear) <> myDate Then
Me.cmdSave.Enabled = False
Else
Me.cmdSave.Enabled = True
End If
If IsNull(Me.cboYear) Then
Me.subform_Register_PublicHolidays.Form.Filter = ""
Me.subform_Register_PublicHolidays.Form.FilterOn = False
Else
Me.subform_Register_PublicHolidays.Form.Filter = "Year(PHDate)=" & Me.cboYear
Me.subform_Register_PublicHolidays.Form.FilterOn = True
End If
Proc_Exit:
Exit Sub
Proc_Error:
MsgBox "Error " & Err.Number & " in setting subform filter:" & vbCrLf & Err.Description
Resume Proc_Exit
End Sub