Un-highlighting Required Fields - Page 2

Thanks Thanks:  0
Likes Likes:  0
Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Un-highlighting Required Fields

  1. #11
    Board Regular
    Join Date
    Jan 2013
    Posts
    172
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Un-highlighting Required Fields

     
    When the form opens, the user will see all the required fields to know what needs to be filled out. The fields are all blank when the form is opened. What I want to do after the user fills out each control is remove the required function as it has already been filled.
    So it's going from a blank or Null to a filled field. The user should be able to only see the fields that are required that have not been filled out yet. There are 14 required fields that will be highlighted in red that are blank and will need to be filled out (these are combinations of text and combo boxes). If the user only fills out 12 of these required fields, then we should see the remaining two fields still in red and the rest converted back to white fields and black label boxes.

    If it helps, this is the site where I picked up the code I posted in my original post.
    http://allenbrowne.com/highlight.html

    Everything works great when I implemented that code, but I'm afraid that my requestor is going to ask if it is possible to remove highlighted fields once the user has entered a value.

  2. #12
    MrExcel MVP
    Moderator
    xenou's Avatar
    Join Date
    Mar 2007
    Location
    Clev. OH, USA
    Posts
    15,620
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Un-highlighting Required Fields

    okay,
    when you add this code to the after update event for the cyclemonth control, do you see the message that confirms the event is firing:
    Code:
    Private Sub CycleMonth_AfterUpdate()
    msgbox "CycleMonth_AfterUpdate Event Fired!"
    If Not IsNull(Me.CycleMonth) Then Me.CycleMonth.BackColor = vbWhite
    End Sub
    You should see something when you enter a value into the (previously empty) field.

    Using: Office 2010/Win7 (work) Office 2010/Win7 (home)

    You are rich in proportion to the number of things you can let alone.
    -- Henry David Thoreau

  3. #13
    Board Regular
    Join Date
    Jan 2013
    Posts
    172
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Un-highlighting Required Fields

    Oh sorry, I did do that and I saw the message that it's firing but it's still being highlighted in red.

  4. #14
    MrExcel MVP
    Moderator
    xenou's Avatar
    Join Date
    Mar 2007
    Location
    Clev. OH, USA
    Posts
    15,620
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Un-highlighting Required Fields

      
    okay, so next you want to check the obvious: what is the backcolor of the control?!

    If it is already vbWhite then changing it to vbWhite will do nothing:

    Code:
    Private Sub CycleMonth_AfterUpdate()
    msgbox "CycleMonth_AfterUpdate Event Fired!"
    msgbox "BackColor of Control is " & me.CycleMonth.BackColor
    msgbox  iif(isnull(me.CycleMonth),"CycleMonth is null!", "Value of CycleMonth is " & me.CycleMonth)
    msgbox "Note: vbWhite integer constant = " & vbWhite
    If Not IsNull(Me.CycleMonth) Then Me.CycleMonth.BackColor = vbWhite
    End Sub
    and also we want to know what the value of the control is so that's there too now - three messages, one to confirm the event, one to report the backcolor, and one to report the new value of CycleMonth.

    Edit: now four messages, one more so we know what vbWhite is too.
    Last edited by xenou; Jan 12th, 2018 at 06:04 PM.

    Using: Office 2010/Win7 (work) Office 2010/Win7 (home)

    You are rich in proportion to the number of things you can let alone.
    -- Henry David Thoreau

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com