I am trying to set a validation rule for a form to see if fields are populated.
I figure using an array of field names within the current form and a loop will solve this without too much coding. Trying to use the array value in the loop is my struggle.
Dim avFields As Variant
Dim vItem As Variant
avFields = Array("inSurvey#", "txtProjectName", "cboPracticeType", "cboProjectType", "cboClient", "txtLaunchDt", "txtEndDt", "cboCRM", "cboPM1", "cboLC1", "cboAN1", "cboCO1", "cboSC1", "cboPRI")
For Each vItem In avFields
Debug.Print vItem
If IsNull(Me.[vbitem]) Then
MsgBox "Please Enter a Project Name", vbOKOnly
Me.vItem.SetFocus
Exit Sub
End If
Next
The hang up is in Me.vItem.SetFocus
.