kevinh2320
New member
- Local time
- Yesterday, 18:28
- Joined
- Mar 29, 2024
- Messages
- 3
On my form, I have a StartDate and EndDate fields for the user to search records. I am using the AfterUpdate event on the EndDate field to trigger the action. If my vba code is set to:
Me.Requery
The code works perfectly and displays the records within the chosen date range. However, if the user enters a date range where no records are found the form displays only the form header leaving the user with a poor experience. I'm not sure how to fix this. I've tried several things to prompt the user their search found no records but keep getting coding errors. Below is my latest attempt. Any suggestion of how to make this work would be appreciated.
Private Sub mo_assigned_date_max_search_txtbox_AfterUpdate()
If Me.Requery Is Null Then
MsgBox "There are no records within the date range entered. Please try again."
Else
Me.Requery
End If
End Sub
Me.Requery
The code works perfectly and displays the records within the chosen date range. However, if the user enters a date range where no records are found the form displays only the form header leaving the user with a poor experience. I'm not sure how to fix this. I've tried several things to prompt the user their search found no records but keep getting coding errors. Below is my latest attempt. Any suggestion of how to make this work would be appreciated.
Private Sub mo_assigned_date_max_search_txtbox_AfterUpdate()
If Me.Requery Is Null Then
MsgBox "There are no records within the date range entered. Please try again."
Else
Me.Requery
End If
End Sub