View Single Post
 
Old 01-11-2020, 11:52 AM
NLJ NLJ is offline Windows 10 Office 2016
Novice
 
Join Date: Jan 2020
Posts: 5
NLJ is on a distinguished road
Default Dependent dropdown and repeat section

I have no experience with VBA and really limited experience using content controls. I'm helping to create a report template to use for approximately a year until we get into an electronic system. The goal is to create efficiency and make reports quicker and easier to complete. There are several content controls and one section to allow free text and lists and a dependent relationship between category and sub-category. The entire section should be repeatable as each report will have a varying number of observations to include. I have been able to modify a VBA code from another website which works for one observation, but this won't work for any additional observations whether I copy and paste or use the section repeat content control. I'm not sure if this makes sense, but I'm hoping that someone can help.
Code:
Sub PopulateddCategory()
    Dim xDirection As FormField
    Dim xState As FormField
    On Error Resume Next
    Set xDirection = ActiveDocument.FormFields("ddCategory")
    Set xState = ActiveDocument.FormFields("ddSub")
    If ((xDirection Is Nothing) Or (xState Is Nothing)) Then Exit Sub
    With xState.DropDown.ListEntries
        .Clear
        Select Case xDirection.Result
            Case "Business Continuity Disaster Recovery"
                .Add "Adherence"
                .Add "Documentation"
                .Add "Procedure"
            Case "Computerized Systems Management"
                .Add "Adherence"
                .Add "Documentation"
                .Add "Procedure"
                .Add "Validation"
            Case "Contract  Agreement"
                .Add "Adherence"
                .Add "Documentation"
                .Add "Procedure"
            Case "Data Collection and Handling"
                .Add "Adherence"
                .Add "Documentation"
                .Add "Procedure"
                .Add "Source Data Verification"
            Case "Good Documentation Practices"
                .Add "Adherence"
                .Add "Procedure"
            Case "Records Management"
                .Add "Investigator Site File"
                .Add "Procedure"
                .Add "Trial Master File Master File"
            End Select
    End With
End Sub
Attached Files
File Type: docm Repeating Dependant DD Question.docm (61.4 KB, 11 views)

Last edited by macropod; 01-11-2020 at 01:31 PM. Reason: Added code tags
Reply With Quote