I have a form that open based on what material you enter. I'd like it to display an error msg and not open the form if no records exist with that material.
In the design view of the form, go to properties of the report and scroll down to the line that says OnNoData. This is where you should create your error message. If not sure what code to use, click on the line OnNodate and hit F1. That should explain what you need to do.
HTH
Maurie An investment in knowledge always pays the best dividends.
Do you have a table that lists all of the possible materaials? jode's example implies if no data exists. I was under the impression that data could exist, but not be accurate, even mispelled. Mispelling is a good reason for having a separate table and then a drop down in the form to choose.
If I am missing the point, I appoligize. An investment in knowledge always pays the best dividends.
Yes I have a table that lists all of the possible available materials. I want it to act as a check. If the entered material exists then open the form to edit the record, if the material does not exist display an error msg to that effect.
I think you could use an If statement with or. Keep in mind, if the number of materails cahnge, then the if statement will have to be changed. Best bet would be to create an if statement on form (a) that checks the items listed in table of materials. If the material exists, open, else msgbox and close form (b). An investment in knowledge always pays the best dividends.
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.