Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2005

    Unanswered: How to make error


    I have a function in the query.

    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.

    Please let me know, thanks.

  2. #2
    Join Date
    Oct 2004
    Oxfordshire, UK
    Don't run the query directly.

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts