Message box when user clicks on any of several fields on a form

I have several fields on a form that display information only.  They are not meant to have data entered or edited.  The fields are all locked and tab stop = No.

In each of the fields I have the tag property set to "Viewable" (without the quote marks.

But if the user clicks on any of the fields I want a msgbox to appear that says "Viewable information only"

Is there a way to make this happen in the oncurrent event of the form?  Or ?  Or do I have to put the msgbox code in each fields on click event?  There are several.
Who is Participating?
Rey Obrero (Capricorn1)Connect With a Mentor Commented:
yes you can

create a function in a regular module

function showMessage()
msgbox  "Viewable information only"
end function

in the click event of the textbox place
Shaun KlineLead Software EngineerCommented:
Instead of displaying a message box, it may be a better approach to use a visual clue that the field is locked, such as changing the text color or the background color. By displaying the message box, an inadvertent click in one of the fields will cause the message box to display and what seems to be a benign alert can quickly become an large annoyance.

Also, if for some reason your user wanted to highlight text in the locked control (textbox) to copy/paste the text elsewhere, this message box again would be an annoyance.
SteveL13Author Commented:
I very much do appreciate your insight.  But in this case we really do want a message box to appear.  Can it be done without having to write the code behind each field's onclick event?
Shaun KlineConnect With a Mentor Lead Software EngineerCommented:
You could write a subroutine that displays the message, but you probably will have to tie it into each field's onclick  event. The onCurrent event of the form happens when the form opens or when the user changes records.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.