PDA

View Full Version : [SOLVED:] Loop through form header for controls null values



oxicottin
05-06-2020, 03:01 PM
Hello, I have a form with just combo boxes and text boxes and I need to loop through all the controls in just the forms header in order to show a few hidden buttons if everything has a value and if not show message and dont show buttons

SamT
05-07-2020, 06:12 AM
I don't usually do Access, but something like this

Dim Ctrl As Object
Dim MissingValues as boolean

For Each Ctrl in Me.Controls
If Ctrl.ControlType = acTextBox then
If Ctrl.Value = "" Then
MissingValues = True
Exit For
End IF
ElseIf Ctrl.ControlType = acListtBox then
If Ctrl.Value = "" Then
MissingValues = True
Exit For
End IF
End if
Next

If MissingValues Then
Show message
Else
Show buttons