Here is both routines. The RED is what I had to change:
Code:
Private Sub WhateverClickEvent() 'use your own sub name; e.g. button click event
Dim ctl As Control
Dim svList As String
For Each ctl In Me.Controls
' Debug.Print ctl.Name
If ctl.ControlType = acTextBox And ctl.Tag = "Reqd" Then
If IsNullEmpty(ctl) Then
svList = svList & ctl.Controls(0).Caption & vbCrLf 'if Reqd and = "" (or is null) then add the label caption to a list)
End If
End If
Next
If svList <> "" Then
MsgBox "You must supply a value for " & vbCrLf & svList 'if list is not empty, message
End If
End Sub
Code:
Public Function IsNullEmpty(ctl) As Boolean
IsNullEmpty = False
If ctl = "" Or IsNull(ctl) Then
IsNullEmpty = True
End If
End Function