I have the below code which works - but i wanted to condense it. due to the number of controls that i need to check.
So i have pulled together this code to check each Control,
Dim ctl As Control
For Each ctl In Me.Controls
Select Case TypeName(ctl)
Case "ComboBox", "TextBox"
If ctl.Tag = "Req" Then
If IsNull(ctl) Then
ctl.backcolour = vbRed
ctl.SetFocus
MsgBox ("Please complete the missing Fields.")
Exit Sub
End If
End If
End Select
Next
I am getting a error message "438 - Object does not support this property or method."
I get this message if any of my Required fields that are null.
Is it that i have got my select case in the wrong position ?
Code:
If IsNull(CboxSite) Then
CboxSite.BackColor = vbRed
CboxSite.SetFocus
MsgBox ("Please complete the missing Fields.")
Exit Sub
Else
CboxSite.BackColor = vbWhite
End If
So i have pulled together this code to check each Control,
Dim ctl As Control
For Each ctl In Me.Controls
Select Case TypeName(ctl)
Case "ComboBox", "TextBox"
If ctl.Tag = "Req" Then
If IsNull(ctl) Then
ctl.backcolour = vbRed
ctl.SetFocus
MsgBox ("Please complete the missing Fields.")
Exit Sub
End If
End If
End Select
Next
I am getting a error message "438 - Object does not support this property or method."
I get this message if any of my Required fields that are null.
Is it that i have got my select case in the wrong position ?