Share via

Changing a default warning message

Anonymous
2022-08-23T15:08:13+00:00

Hello:

On one of the tables in a Db I've created I've made Last Name, and First Name required fields. It works like I want it to, but is there a way to change the message box below to read something such as "You must enter a First Name for this candidate" instead of 'You must enter a value in the TblCanC.FN field"

Thank you,

Robert

Microsoft 365 and Office | Access | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

ScottGem 68,830 Reputation points Volunteer Moderator
2022-08-23T16:40:35+00:00

You have to write code using the code builder, not just enter a MsgBox function in the event box.

The messages displayed for Required fields that are not entered occur when you try to save the record on the form. So you would have to use a Form event not a Control event.

But a better option would be to use the Controls Before Update or On Exit events.

Then you would use code like:

If Me.controlname = Null then

   MsgBox "You must enter a value"

   Cancel = True

   Me.Controlname.SetFocus

End If

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

5 additional answers

Sort by: Most helpful
  1. George Hepworth 22,855 Reputation points Volunteer Moderator
    2022-08-23T15:35:02+00:00

    You would write your own content. Something like:

    MsgBox Prompt:="You must enter a name in the First Name field", Buttons:=vbAlert + vbOkOnly, Title:="Required Value Missing"

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2022-08-23T15:28:22+00:00

    Hello There.

    I placed the message box in "before update" event. I still get the same message. Is there a way to adjust the default message box?

    Thank you,

    Robert

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2022-08-23T15:28:10+00:00

    Hello There.

    I placed the message box in "before update" event. I still get the same message. Is there a way to adjust the default message box?

    Thank you,

    Robert

    Was this answer helpful?

    0 comments No comments
  4. George Hepworth 22,855 Reputation points Volunteer Moderator
    2022-08-23T15:15:47+00:00

    Yes, you can do this with a custom message box from within the Control's Before Update event or from within the Form's Before Update event.

    Was this answer helpful?

    0 comments No comments