Fill the field - otherwise don't save record

Do YOU know other solutions to force the input in specific fields before storing the record than unsing ‘notBlank’ (that’s no solution) or opening another form where this is programmed? (not a key field…) thanks H.-W. Kalis

Add a boolean key-field like “All Required Fields Filled” and set the NotBlank property to Yes. Put the following code in every validation-trigger of the required fields:

"All Required Fields Filled" := ((Field1 <> '') AND (Field2 <> '') AND  . . . . );

Regards, Reijer PS: Is this what you mean with “not a key field…”?

Modify the OnInsert and OnModify triggers on the table for checking the fields are you needing to have filled. example: field to control = field1 Then change the record form to delayedInsert = True OnInsert TESTFIELD(field1); OnModify TESTFIELD(field1); Regards, Alfonso Pertierra (Spain)apertierra@teleline.es

Thanks Alfonso. Next time I have to deal with this I do it your way. (I love this site)

You’re welcome :wink: Regards, Alfonso Pertierra (Spain)apertierra@teleline.es

Keep in mind that testfield(field1) has a little side effect. It wil clear all the changes you made to other fields. Willy

quote:


Originally posted by reijer: Hello, thanks for the answer. Did your changes, but there is still a debitor dataset without a cost_center_code (Kostenstelle). debitor-card - F3 - Enter - dataset exists and field is empty!!! What did I wrong?? Add a boolean key-field like “All Required Fields Filled” and set the NotBlank property to Yes. Put the following code in every validation-trigger of the required fields:

"All Required Fields Filled" := ((Field1 <> '') AND (Field2 <> '') AND  . . . . );

Regards, Reijer PS: Is this what you mean with “not a key field…”?


Kalis, your problem is the OnInsert Event. If you let them inserting the record (F3+Enter) before having those fields filled or forcing to fill them before the insertion, nothing forces them to fill them after… if they just leave the record they will have an empty record just filled with the key. That’s why it’s a good idea when you need to have ALLWAYS that fields filled to use the DelayedInsert property of the forms and use a checking routine on the OnInsert Event of the table. Regards Alfonso Pertierra (Spain)apertierra@teleline.es

Thank you, but it is better to use an extra Form to fill in the fields. After F3-Enter the other non-key-fields are not deleted because the extra form appears to fill in the necessary fields. ok checks the correctness, cancel → all field fields gone as with the other solutions.