Consulting

Results 1 to 2 of 2

Thread: Loop through form header for controls null values

  1. #1

    Loop through form header for controls null values

    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

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,812
    Location
    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
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •