Hi,
Is there a way to call the sub attached to a datepicker_change() each time the value is changed after userform initialization?
Below is the event code, what i have found is that if the user selects the wrong date initally and an existing record is found which returns values into the textbox controls, after they change the date again to the correct date the change event does not get called again and the form remains in the "update" state.
Any ideas how I can have the event triggered each time the date picker value is changed? Or does the userform need to be reset? How can this be done?
Cheers
Dylan
Is there a way to call the sub attached to a datepicker_change() each time the value is changed after userform initialization?
Below is the event code, what i have found is that if the user selects the wrong date initally and an existing record is found which returns values into the textbox controls, after they change the date again to the correct date the change event does not get called again and the form remains in the "update" state.
Code:
[COLOR=#333333]
Private Sub BoxDate_Change()
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.DisplayStatusBar = False
Dim dFind As Date
Dim ctl As MSForms.Control
If IsDate(BoxDate) = False Then Exit Sub
dFind = BoxDate
With Range("DateWS") 'a named range on sheet listing dates
Set DateFound = .Find(dFind)
If DateFound Is Nothing Then
Exit Sub
Else
With DateFound
On Error Resume Next
If .Offset(0, 1) <> "" Then
BoxOperator = .Offset(0, 1)
Else: BoxOperator = ""
End If
If .Offset(0, 2) <> "" Then
Page1Box1 = .Offset(0, 2)
Else: Page1Box1 = ""
End If
If .Offset(0, 3) <> "" Then
Page1Box2 = .Offset(0, 3)
Else: Page1Box2 = ""
End If
If .Offset(0, 4) <> "" Then
Page1Box3 = .Offset(0, 4)
Else: Page1Box3 = ""
End If
End With
End If
End With
Application.DisplayStatusBar = True
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
cmdSubmit.Caption = "Update & Close"
MsgBox ("Record Found!")
End Sub[/COLOR]
Any ideas how I can have the event triggered each time the date picker value is changed? Or does the userform need to be reset? How can this be done?
Cheers
Dylan
Last edited: