Hello and thank you for taking the time to help with this question!
I have a group of controls on a form that I have used the Tag property = "Status". I would like the message box to populate the name of the textbox(s) that is blank
within the group tagged "Status" causing the message box to display. Everything works as it currently is but I would like it to be more specific and tell the user what field they actually missed.
Thank you for any advice you can provide!
Code:
Private Sub btnTotalScore_Click()
Dim c As Control, nYes As Long, nPartial As Long, nNo As Long, nNA As Long
nYes = 0
nPartial = 0
nNo = 0
nNA = 0
For Each c In Me.Controls
Select Case c.Name
Case "cboStatus", "cboEmployee", "cboStatus"
Case Else
If TypeName(c) = "ComboBox" Then
If c.Value = "Yes" Then nYes = nYes + 1
If c.Value = "Partially" Then nPartial = nPartial + 1
If c.Value = "No" Then nNo = nNo + 1
If c.Value = "NA" Then nNA = nNA + 1
End If
End Select
Next c
txtTotalScore = Format((nYes + nPartial * 0.5) / (nYes + nPartial + nNo + nNA), "Percent")
For Each c In Me.Controls
If c.Tag = "Status" Then
If IsNull(c.Value) Then MsgBox ("A categoryhas been left incomplete. Please review and update before continuing.")
End If
Next c
End Sub