Query using DateTimePicker giving error, but only sometimes

Currently the best workaround that I have is to hide the table when I get an error in the query:
image

And then show a notification to the user: