When I run the query, it will have a input box to enter the value, if the user enter wrong format, the query still can run , but no result come out. So, how can I make that the query does NOT run when the user enter the wrong value/format.
1. Get the user to enter data in a text box on a form.
2. Write a textBox_AfterUpdate procedure to validate the data entry
a. If the data format is incorrect use the msgbox function to prompt the user.
b. If the data is OK build an SQL string and make that SQL source for the query, then open it.
Better still, don't use a query at all, and use the SQL string as the RecordSource property of the form or report if you want to display the data, or as the SQL string for a recordset if you're manipulating the data programatically.