I have a tricky little problem which I'll try to explain the best way I can.
This number field needs to auto-increment by 1 but only if at least one record exists in a related table.
The relationship to the related table is:
Site::__kpSiteID = KeyDetails::_kfSiteID
On the "Site" layout there is a portal to the "KeyDetails" table so I need a calculation to identify whether there are any related records or not. If there are, then assign a number to the "Site::KeyReceipt: field based on the highest number already in use plus 1. If there are no records, then the "Site::KeyReceipt" field remains blank.