PLease post the script you have set up to be performed by the OnObjectValidate trigger. It sounds like your script is committing the record.
To post a script to the forum:
- You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
- You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
- If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
- If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
You are correct Phil. The script was calling for a new record if validation failed. Fixed that but I still don't have this working correctly though. Here is my script now:
- If [ not (Contracts::cont_CustCode = Customers::cust_CustCode) ]
- Show Custom Dialog [ Title: "Error"; Message: "Sorry, we do not have a customer with that Code. Please click Cancel and then enter a Valid Customer Code."; Default Button: “Cancel”, Commit: “No” ]
- End If
Two Tables, Customer and Contract. Both have a CustCode field. What I want to do is to ensure that the user enters an existing (in the Customers table) code as the ContractCustomer code in the contracts table. I want FMP to notify the user as the user tabs out of the ContractCustomer code field the FMP cannot find that particular code in the customers table.
For some reason the custom dialogue appears even if the test is met. When the dialogue is canceled the relation is estblished.
YOu need an ExitScript [False] step to return control to the field so that the validations aren't triggered.
But it should be possible to use a value list or other methods to select from a list of existing customer codes instead of requiring the user to correctly enter one.