well this is what it does.. It bypasses my error message and continues to yours. Eventhough it is the error number 3421. But either way, it doesn't pop the prompt back up for the user to try again.
I don't believe that the inputbox function allows you to react to buttom clicks like the msgbox function does. You may have to place a cancel button on the form itself.
You can also check the SearchStr$ after the input box function and if it ="" then you can exit and close the form. Just a thought. Thanks and Good Luck!
Should I change the prompt to a message box? I would really like the user to exit out if they must. BEcause as it stands now, they enter a correct number it allows them to get to the form. If they enter a wrong number it gevver them the error and lets them try again. If they put nothing then it keeps prompting for a number. But what if they opened the form by mistake? The prompt opens up and then they have no way to exit.
By changing to a msgbox function you will lose the ability to retrieve user input. So that may not be what you want.
What I would do is to add a text box on the form that allows the user to enter the class number. Until a valid number is entered the rest of the form is disabled. This forces the user to enter a number. If want to exit the form you can have a close or cancel button right on the form that will close it. This will also remove the need for the input box. You will also need to add a find button that they can click to find the class.
This also gives you the opportunity to use the text boxes .keydown event to ensure that only numbers are entered by not allowing anything else.
This way if no record is found the user just enters a new value and clicks the find button again.
Another option would be to create a form that acts and looks like an input box and then you could deal with the click event of a cancel button. This however will require the passing of variables from one form to another or global variables. Thanks and Good Luck!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.