Hey,
So I'm working on a form that aims to automatically display records based on the values of two textboxes. The textboxes are defined as dates, so the little calendar icon will pop up when you click into it. Some users prefer to type their date rather than use the calendar.
Here's where I go wrong. I have an Event Procedure OnChange that defines and SQL Query and defines the "date range" of the SQL Query using the values in the textbox. When the user deletes the current value in textbox, this causes errors when the code automatically tries to run this SQL Query. For example: the default value of the textbox is Date(). The user wishes to change the day so they naturally click into the day portion of the date and hit backspace to clear the day. When they clear the day, the textbox reads "01//2017" (or something similar). When the SQL Query attempts to open a recordset using that date range I get a syntax error because #01//2017# is not a valid date.
Is there a better way to do this and am I approaching this problem in the right way? I've looked into validation rules/text, but I don't have a strong grip on it. So I figured I'd post here to see if anyone had some insight.
Thank you.