I have a form with all data entry fields set to disabled. The form is used to enter issues and data associated with 3 different issue types. I have a combo box that allows the user to select the issue type they are entering. I have the code below that enables and highlights required fields for the selected issue types. The code works fine with one exception - if the user mistakenly selects the wrong issue type, when they go back and select the proper type the fields that were previously enabled and highlighted remain as such.
I would like to make it so that if the user selects the wrong issue type and then changes it, all the fields are set to their original state and then the appropriate fields are enabled and highlighted based on the corrected selection.
Wrong selection made - fields for that selection enabled\highlighted.
Correct selection made - irrelevant fields locked\highlight removed, appropriate fields enabled\highlighted.
Or is it just easier to reload the form and make the proper selections from that point? I have a few required fields so I would like to suppress prompting in that case. I can't seem to get this method to work either.
Private Sub Category_AfterUpdate()
On Error GoTo Error_Handler
If Me.Category.Text = "Product Hold" Then
Me.Description.BorderColor = RGB(0, 255, 0)
Me.Description.Enabled = True
If Me.Category.Text = "PCAR" Then
Me.Comments.BorderColor = RGB(0, 255, 0)
Me.Comments.Enabled = True
MsgBox Err.Description, vbOKOnly, "Error #" & Err.Number