To display on-screen field values in messages, refer to these values using embedded method calls and the FORMULA() method. This allows you to concatenate on-screen values with hard-coded message text.
MessageError(FORMULA(':1 || :2 || :3',
'All tours to ', query.destination(), ' are fully booked.'))
The resulting message could be:
All tours to Africa are fully booked.
The text you want to have displayed. Note the following:
If you intend to have your application translated, use MessageLanguage() instead.
A call to MessageError() triggered (directly or indirectly) from a validation event will be executed if and only if the error flag has been raised before with ErrorRaise(). Hence, if the flag has not been raised, then all calls to MessageError() will be ignored.