richh
Board Regular
- Joined
- Jun 24, 2007
- Messages
- 245
- Office Version
- 365
- 2016
Is there any way to loop through the frames and cycle through the controls within them? I'm not as familar with frames as I thought...
I'm trying to verify that data has been entered into my controls before going forward. the loop will highlight the requred controls and exit the code if a required field is blank.
Dim f As Frame
Dim ctl As Control
'not sure about the first two lines of this code
For Each f In Me.Controls
For Each ctl In f.Controls
If ctl.Tag = "r" Then
' This is a required entry
If ctl.Value = "" Then
' Required entry is blank so set the backcolor to yellow
ctl.BackColor = vbYellow
' Capture the name of the cotrol to display to user
strMsg = strMsg & ctl.Name & vbCrLf
Else
' Required entry is populated so set the backcolor to white
ctl.BackColor = vbWhite
End If
End If
Next
Next
' Alert the user if required entries are missing
If Len(strMsg) > 0 Then
MsgBox "Please enter the required data", vbInformation, "Required Entry"
GoTo logVisit_Click_Exit
End If
Thanks anyone who can lend their assistance.
I'm trying to verify that data has been entered into my controls before going forward. the loop will highlight the requred controls and exit the code if a required field is blank.
Dim f As Frame
Dim ctl As Control
'not sure about the first two lines of this code
For Each f In Me.Controls
For Each ctl In f.Controls
If ctl.Tag = "r" Then
' This is a required entry
If ctl.Value = "" Then
' Required entry is blank so set the backcolor to yellow
ctl.BackColor = vbYellow
' Capture the name of the cotrol to display to user
strMsg = strMsg & ctl.Name & vbCrLf
Else
' Required entry is populated so set the backcolor to white
ctl.BackColor = vbWhite
End If
End If
Next
Next
' Alert the user if required entries are missing
If Len(strMsg) > 0 Then
MsgBox "Please enter the required data", vbInformation, "Required Entry"
GoTo logVisit_Click_Exit
End If
Thanks anyone who can lend their assistance.
Last edited: