Not sure if this will help:
VBA Code:
If Me.myCombo = "Managed account number" Then
With Me
.Txt_Repid.Visible = False
.Txt_RepName.Visible = False
.Txt_RepCompany.Visible = False
.Txt_RepAuthLevel.Visible = False
End With
End If
You could repeat that for other combo selections, or even consolidate that code IF there will only ever be 2 combo choices. Plus, I've no idea if the combo is bound and if so, which column, so if there is more than one column and the bound column is not the first column, you'll need the column reference, as in Me.myCombo.Column(x) where you provide the value for x. The column property is zero based by the way.
There's no point in setting the background color of an invisible combo.
Adding multiple field values to one textbox is not a good idea IMO but your code could simply concatenate each field into one string, which you then make the target field equal to that. If a control has no value, nothing will be concatenated. Your issue there might be that you also want separators such as commas or semicolons so may have to deal with that. You only choose to concatenate based on what the combo value (remember, might neet to be the column value) and the IF block of code that tests that will decide whether or not to concatenate.
I'm guessing that you'd use the combo after update event, but not enough post info to say for sure.
Yes thanks a lot some of the code for the project is seen below
Option Explicit
Private Sub CB_Reset_Click()
Application.ScreenUpdating = False
Unload Me
HCCSH_UF.Show
Application.ScreenUpdating = True
End Sub
Private Sub Userform_Initialize()
' to write prefilled text for textboxes
'Lbl_AgentName.Caption = Sheets("Agent & Team Info").Range("B1").Value 'Agents Name
'Lbl_AgentID.Caption = Sheets("Agent & Team Info").Range("B2").Value 'Agents ID
Txt_HCCSHCallStartTime.Value = Format(Now(), "mmmm/dd/yyyy - hh:mm:ss") 'Call start time
Txt_POC.MultiLine = True 'to allow multiple line in Purpose of call textbox
Txt_POC.Value = Format(Txt_POC.Value, "General")
Txt_POC.Value = "Reason for the call: TP xxxxxxxxxxxxx" 'prefilled text for purpose of call
'Txt_SecQue.MultiLine = True 'to allow multiple line in Purpose of call textbox
'Txt_SecQue.Value = Format(Txt_SecQue.Value, "General")
'Txt_SecQue.Value = " Answered correctly: < question > < question > " & vbNewLine & " Answered correctly: < question > < question >"
Txt_CallNotes.MultiLine = True
Txt_CallNotes.Value = Format(Txt_CallNotes.Value, "General")
Txt_TSADiNP.MultiLine = True
Txt_TSADiNP.Value = Format(Txt_CallNotes.Value, "General")
Txt_ELCSNPTemp.MultiLine = True
Txt_ELCSNPTemp.Value = Format(Txt_ELCSNPTemp.Value, "General")
Txt_SecQue1.Value = "< Question >"
Txt_SecQue1.Value = Format(Txt_SecQue1.Value, "General")
Txt_SecQue2.Value = "< Question >"
Txt_SecQue2.Value = Format(Txt_SecQue2.Value, "General")
Txt_SecQue3.Value = "< Question >"
Txt_SecQue3.Value = Format(Txt_SecQue3.Value, "General")
Txt_SecQue4.Value = "< Question >"
Txt_SecQue4.Value = Format(Txt_SecQue4.Value, "General")
MP_CallInfo.Pages("Pg_Rep").Visible = False
Txt_SecLevMea.Enabled = False
Txt_SecLevMea.BackColor = vbScrollBars
' to click if the purpose of the call is account specific
If TB_AccountSpecific.Value = False Then
CB_CallerType.Enabled = False
CB_CallerType.BackColor = vbScrollBars
Txt_SecLevMea.Enabled = False
Txt_SecLevMea.BackColor = vbScrollBars
MP_CallNotes.Visible = False
MP_CallInfo.Pages("Pg_Rep").Visible = False
MP_SecQue.Pages("Pg_SecQue2").Visible = False
End If
End Sub
Private Sub Txt_POC_AfterUpdate()
Dim POCAlert As String
Dim LstCTr As Range
Dim LstTrnd As Range
Set LstTrnd = ThisWorkbook.Worksheets("Lists").Range("List_Trained")
Set LstCTr = ThisWorkbook.Worksheets("Lists").Range("List_CallTier")
POCAlert = MsgBox("Are you Trained on this request Tier? ", vbQuestion + vbYesNoCancel, "Call Tier Check")
If POCAlert = vbYes Then
CB_CallTier.Value = "Trained Teirs"
CB_CallTier.RowSource = LstTrnd.Address(External:=True)
ElseIf POCAlert = vbNo Then
TierSecurity_UF.Show
CB_CallTier.Value = "Pick From Below"
Me.CB_CallTier.RowSource = LstCTr.Address(External:=True)
End If
End Sub
Private Sub TB_AccountSpecific_Change()
'to enable the input fields if it is account specific
If TB_AccountSpecific.Value = True Then
TB_AccountSpecific.Caption = "Yes it is!"
CB_CallerType.Enabled = True
CB_CallerType.BackColor = vbWindowBackground
'Txt_SecLevMea.Enabled = False
Txt_SecLevMea.BackColor = vbWindowBackground
MP_CallInfo.Visible = True
MP_CallNotes.Visible = True
Else
TB_AccountSpecific.Caption = "No its not!"
CB_CallerType.Enabled = False
CB_CallerType.Value = " "
CB_CallerType.BackColor = vbScrollBars
Txt_SecLevMea.Enabled = False
Txt_SecLevMea.Value = " "
Txt_SecLevMea.BackColor = vbScrollBars
Me.MP_CallInfo.Pages("Pg_Rep").Visible = True
MP_CallNotes.Visible = False
MP_CallInfo.Pages("Pg_Rep").Visible = False
End If
End Sub
Private Sub TB_Pin_Change()
Dim AuthenticationPIN As String
'to enable the specific input fields if there is a pin on the account
If TB_Pin.Value = True Then
TB_Pin.Caption = "YES!"
AuthenticationPIN = MsgBox(" Did the Taxpayer used their PIN to authenticate themselves on HCCS ? ", vbCritical + vbYesNoCancel, "Authentication status")
If AuthenticationPIN = vbYes Then
Frm_DOB.Enabled = False
Frm_Address.Enabled = False
OB_DOBY.Enabled = False
OB_DOBN.Enabled = False
OB_AddressY.Enabled = False
OB_AddressN.Enabled = False
Txt_SecLevMea.Value = "Authentication Status PIN"
ElseIf AuthenticationPIN = vbNo Then
TB_Pin.Value = False
TB_Pin.Caption = "No!"
OB_DOBY.Enabled = True
OB_DOBN.Enabled = True
OB_AddressY.Enabled = True
OB_AddressN.Enabled = True
Txt_SecLevMea.Value = " Enhanced PIN not Used"
End If
Else
TB_Pin.Value = False
TB_Pin.Caption = "NO!"
Frm_DOB.Enabled = True
Frm_Address.Enabled = True
OB_DOBY.Enabled = True
OB_DOBN.Enabled = True
OB_AddressY.Enabled = True
OB_AddressN.Enabled = True
Txt_SecLevMea.Value = " "
Txt_SecLevMea.Value = " Enhanced PIN not Used"
End If
End Sub
Private Sub CB_CallerType_Change()
'to change the Rep text boxes to be inactive when not needed
If CB_CallerType.Value = "Taxpayer" Then
Me.MP_CallInfo.Pages("Pg_Rep").Visible = False
Txt_RepID.Enabled = False
Txt_RepID.BackColor = vbScrollBars
Txt_RepName.Enabled = False
Txt_RepName.BackColor = vbScrollBars
Txt_RepComp.Enabled = False
Txt_RepComp.BackColor = vbScrollBars
CB_RepAuth.Enabled = False
CB_RepAuth.BackColor = vbScrollBars
Frm_PIN.Enabled = True
TB_Pin.Enabled = True
ElseIf CB_CallerType.Value = "Rep" Then
Me.MP_CallInfo.Pages("Pg_Rep").Visible = True
Txt_RepID.Enabled = True
Txt_RepID.BackColor = vbWindowBackground
Txt_RepName.Enabled = True
Txt_RepName.BackColor = vbWindowBackground
Txt_RepComp.Enabled = True
Txt_RepComp.BackColor = vbWindowBackground
Txt_RepID.TabIndex = 0
CB_RepAuth.Enabled = True
CB_RepAuth.BackColor = vbWindowBackground
Frm_PIN.Enabled = False
TB_Pin.Enabled = False
End If
End Sub
Private Sub CB_ELCSNPTemp_Change()
'to lookup note pad templates,
On Error Resume Next
Me.Txt_ELCSNPTemp.Text = Application.WorksheetFunction.VLookup(Me.CB_ELCSNPTemp.Value, [ELCS], 2, False) ' to change the value in the ELCS Notepad Template text box.
On Error GoTo 0
End Sub
Private Sub OB_SINY_Click()
SANDTOMBTextbox
End Sub
Private Sub OB_SINN_Click()
SANDTOMBTextbox
End Sub
Private Sub OB_AddressY_Click()
SANDTOMBTextbox
End Sub
Private Sub OB_AddressN_Click()
SANDTOMBTextbox
End Sub
Private Sub OB_DOBY_Click()
SANDTOMBTextbox
End Sub
Private Sub OB_DOBN_Click()
SANDTOMBTextbox
End Sub
Private Sub OB_NameY_Click()
SANDTOMBTextbox
End Sub
Private Sub OB_NameN_Click()
SANDTOMBTextbox
End Sub
'And so on setting click event for each option to 'SetTextbox'
Private Sub SANDTOMBTextbox()
If OB_SINY.Value = True And _
OB_AddressY.Value = True And _
OB_DOBY.Value = True And _
OB_NameY.Value = True Then
Txt_TOMB.Value = "SAND Met"
ElseIf OB_SINN.Value = True And _
OB_AddressY.Value = True And _
OB_DOBY.Value = True And _
OB_NameY.Value = True Then _
Txt_TOMB.Value = "SAND Not Met"
ElseIf OB_AddressN.Value = True And _
OB_SINY.Value = True And _
OB_DOBY.Value = True And _
OB_NameY.Value = True Then _
Txt_TOMB.Value = "SAND Not Met"
ElseIf OB_DOBN.Value = True And _
OB_SINY.Value = True And _
OB_AddressY.Value = True And _
OB_NameY.Value = True Then _
Txt_TOMB.Value = "SAND Not Met"
ElseIf OB_NameN.Value = True And _
OB_SINY.Value = True And _
OB_AddressY.Value = True And _
OB_DOBY.Value = True Then _
Txt_TOMB.Value = "SAND Not Met"
ElseIf TB_Pin.Value = True And _
OB_SINY.Value = True And _
OB_NameY.Value = True Then
Txt_TOMB.Value = "PIN SAND Met"
ElseIf TB_Pin.Value = True And _
OB_SINY.Value = True And _
OB_NameN.Value = True Then
Txt_TOMB.Value = "PIN SAND Not Met"
End If
End Sub
Private Sub Txt_TOMB_Change()
Dim CheckELCSNP As String
Dim AnswerNo As String
Dim CallverificationFailed As String
'to enable the specific input fields if there is a pin on the account
If Txt_TOMB.Value = "SAND Met" Or _
Txt_TOMB.Value = "PIN SAND Met" Then
CheckELCSNP = MsgBox(" Does the ELCS Notepad indicates that the taxpayer failed caller verification in the past 30 days ? ", vbCritical + vbYesNo, "Step 4 Check ELCS Notepad")
If CheckELCSNP = vbNo Then
SecurityLevelMeasure_UF.Show
'AnswerNo = MsgBox("Does this Request require Enchanced Security Verification ?" & vbNewLine & "Hit Cancel if Caller used PIN to Authenticate themselves ", vbCritical + vbYesNoCancel, "Security Verification")
'If AnswerNo = vbYes Then
'Txt_SecLevMea.Value = "Enhanced"
'ElseIf AnswerNo = vbNo Then
'Txt_SecLevMea.Value = "Regular"
'End If
ElseIf CheckELCSNP = vbYes Then
CallverificationFailed = MsgBox(" Is the level of this call (regular or enhanced) the same as the previously failed call(s) ", vbExclamation + vbYesNo, "Step 4 Check ELCS Notepad")
If CallverificationFailed = vbYes Then
CallerVerificationPST_UF.Show
End If
End If
End If
End Sub
Private Sub OB_SecQue1Y_Click()
SecQueTextbox
End Sub
Private Sub OB_SecQue1N_Click()
SecQueTextbox
End Sub
Private Sub OB_SecQue2Y_Click()
SecQueTextbox
End Sub
Private Sub OB_SecQue2N_Click()
SecQueTextbox
End Sub
Private Sub OB_SecQue3Y_Click()
SecQueTextbox
End Sub
Private Sub OB_SecQue3N_Click()
SecQueTextbox
End Sub
Private Sub OB_SecQue4Y_Click()
SecQueTextbox
End Sub
Private Sub OB_SecQue4N_Click()
SecQueTextbox
End Sub
'And so on setting click event for each option to 'SetTextbox'
Private Sub SecQueTextbox()
'Two questions for the pass or fail
If OB_SecQue1Y.Value = True And _
OB_SecQue2Y.Value = True Then
Txt_SecQue1PF.Value = "Passed"
ElseIf OB_SecQue1N.Value = True And _
OB_SecQue2N.Value = True Then
Txt_SecQue1PF.Value = "Failed"
ElseIf OB_SecQue1Y.Value = True And _
OB_SecQue2N.Value = True Then
Txt_SecQue1PF.Value = "Failed"
ElseIf OB_SecQue1N.Value = True And _
OB_SecQue2Y.Value = True Then
Txt_SecQue1PF.Value = "Failed"
ElseIf OB_SecQue1N.Value = True And _
OB_SecQue1N.Value = True Then
Txt_SecQue1PF.Value = "Failed"
End If
'if one of the first two questions is wrong a second page open for another two question.
If Txt_SecQue1PF.Value = "Failed" Then
MP_SecQue.Pages("Pg_SecQue2").Visible = True
ElseIf Txt_SecQue1PF.Value = "Passed" Then
MP_SecQue.Pages("Pg_SecQue2").Visible = False And _
Txt_SecQue3.Enabled = False And _
Txt_SecQue4.Enabled = False And _
OB_SecQue3Y.Enabled = False And _
OB_SecQue3N.Enabled = False And _
OB_SecQue4Y.Enabled = False And _
OB_SecQue4N.Enabled = False
End If
'Three questions for the pass or fail
If OB_SecQue1Y.Value = True And _
OB_SecQue2N.Value = True And _
OB_SecQue3Y.Value = True Then
Txt_SecQue1PF.Value = "Passed"
Txt_SecQue2PF.Value = "Passed"
ElseIf OB_SecQue1N.Value = True And _
OB_SecQue2Y.Value = True And _
OB_SecQue3Y.Value = True Then
Txt_SecQue1PF.Value = "Passed"
Txt_SecQue2PF.Value = "Passed"
ElseIf OB_SecQue1Y.Value = True And _
OB_SecQue2N.Value = True And _
OB_SecQue3N.Value = True Then
Txt_SecQue1PF.Value = "Failed"
Txt_SecQue2PF.Value = "Failed"
ElseIf OB_SecQue1N.Value = True And _
OB_SecQue2Y.Value = True And _
OB_SecQue3N.Value = True Then
Txt_SecQue1PF.Value = "Failed"
Txt_SecQue2PF.Value = " "
ElseIf OB_SecQue1Y.Value = True And _
OB_SecQue2N.Value = True And _
OB_SecQue3N.Value = True Then
Txt_SecQue1PF.Value = "Failed"
Txt_SecQue2PF.Value = " "
ElseIf OB_SecQue1N.Value = True And _
OB_SecQue2N.Value = True And _
OB_SecQue3N.Value = True Then
Txt_SecQue1PF.Value = "Failed"
Txt_SecQue2PF.Value = "Failed"
End If
'Four questions for the pass or fail
If OB_SecQue1Y.Value = True And _
OB_SecQue2N.Value = True And _
OB_SecQue3N.Value = True And _
OB_SecQue4Y.Value = True Then
Txt_SecQue1PF.Value = "Passed"
Txt_SecQue2PF.Value = "Passed"
ElseIf OB_SecQue1N.Value = True And _
OB_SecQue2Y.Value = True And _
OB_SecQue3N.Value = True And _
OB_SecQue4Y.Value = True Then
Txt_SecQue1PF.Value = "Passed"
Txt_SecQue2PF.Value = "Passed"
ElseIf OB_SecQue1N.Value = True And _
OB_SecQue2N.Value = True And _
OB_SecQue3Y.Value = True And _
OB_SecQue4Y.Value = True Then
Txt_SecQue1PF.Value = "Passed"
Txt_SecQue2PF.Value = "Passed"
ElseIf OB_SecQue1N.Value = True And _
OB_SecQue2N.Value = True And _
OB_SecQue3N.Value = True And _
OB_SecQue4N.Value = True Then
Txt_SecQue1PF.Value = "Failed"
Txt_SecQue2PF.Value = "Failed"
ElseIf OB_SecQue1N.Value = True And _
OB_SecQue2Y.Value = True And _
OB_SecQue3N.Value = True And _
OB_SecQue4N.Value = True Then
Txt_SecQue1PF.Value = "Failed"
Txt_SecQue2PF.Value = "Failed"
ElseIf OB_SecQue1N.Value = True And _
OB_SecQue2N.Value = True And _
OB_SecQue3Y.Value = True And _
OB_SecQue4N.Value = True Then
Txt_SecQue1PF.Value = "Failed"
Txt_SecQue2PF.Value = "Failed"
ElseIf OB_SecQue1N.Value = True And _
OB_SecQue2N.Value = True And _
OB_SecQue3N.Value = True And _
OB_SecQue4Y.Value = True Then
Txt_SecQue1PF.Value = "Failed"
Txt_SecQue2PF.Value = "Failed"
End If
End Sub
Private Sub CMDB_WriteNote_Click()
'to combine all the feild for input into TSAD-i
'"," & " Security Questions: " & "< " & Txt_SecQue.Value & " >" &
Txt_TSADiNP.Value = Txt_POC.Value & _
"," & vbNewLine & " TOMB/SNDA: " & "< " & Txt_TOMB.Value & " >" & "," & " Answered " & "< "" 1 " & Txt_SecQue1.Value & " " & OB_SecQue1Y.Value & " > <"",2 " & Txt_SecQue2.Value & " " & OB_SecQue2Y.Value & " >" & _
"," & " Answered " & "< "",3 " & Txt_SecQue3.Value & " " & OB_SecQue3Y.Value & ">< "",4 " & Txt_SecQue4.Value & " " & OB_SecQue4Y.Value & " >" & _
"," & " Security Level Measure: " & "< " & Txt_SecLevMea.Value & " " & Txt_SecQue1PF.Value & " >" & _
"," & vbNewLine & " Call Notes: " & "< " & Txt_CallNotes.Value & " >" & _
"," & vbNewLine & " Caller Type: " & "< " & CB_CallerType.Value & " >" & _
"," & " Call Teir: " & "< " & CB_CallTier.Value & " >" & _
"," & vbNewLine & " Rep ID: " & "< " & Txt_RepID.Value & " >" & _
"," & " Rep Name: " & "< " & Txt_RepName.Value & " >" & _
"," & " Rep Company: " & "< " & Txt_RepComp.Value & " >" & _
"," & " Rep Authorization: " & "< " & CB_RepAuth.Value & " >"
End Sub