Does anyone know how to prevent users opening a form if the record they want to view is currently opend by another user (ie locked).

What I'd like to to is display a message box saying something like this record is cuurently opened by user xxxx.

Thanks!