Archives

Great Links

Use the VALID Event for Error Checking

Anybody who has developed with VBA and FastForms long enough has most likely run into the following error message.

I cannot tell you exactly why this error occurs, because I’ve never received an answer from support. I know the surest way to trigger it is to attempt to error check fields during the SAVE or BEFORESAVE events with VBA when using FastForms.

For example, if you use the following VBA code on the Inventory Screen (INV), you will not receive an error no matter how many times you interrupt the saving process. Keep in mind that I have used VBA to first create the txttest text box on my form on the INIT event before calling this code.

Up until fairly recently, that error message was at the top of my list of annoyances. When a manager asked me if I could force users to enter the “right” values in my fields, I had to give an unacceptable answer. The answer was that I could either warn them that they had made a mistake, but ultimately allow them to do so, or I could force them to input appropriate information and risk an error like the one shown above. Neither of these options really solved the problem.

However, there is an undocumented event that many (if not all) screens support, which is called VALID. The VALID event, which I suppose is an abbreviation of validation, occurs before the BEFORESAVE event and can reliably interrupt the save process for FastForms. The following code will work repeatedly on the INV screen using the same FastForms text box control.

1 comment to Use the VALID Event for Error Checking

I have tested using the VALID() function on the PO form and the SO form and you can use it to prevent the BeforeSave and Save methods from firing by returing a FALSE in the VALID() function. Works great!