change required property in vba

MysticElaine

Registered User.
Local time
Today, 01:26
Joined
May 26, 2014
Messages
24
Hello,

I have a form that has some controls whose properties are already listed as required in the table. However, it also has a combo box labeled "Outcome" that changes what textboxes are enabled depending on what is chosen in that combobox. What I would like to do, is make sure that whatever textboxes are enabled are also required. Is this possible? Here is my code for the Outcome combo
Code:
Private Sub Outcome_Change()
If [Outcome] = "Pending" Then
    [Date Provided].Enabled = False
    [Date Provided] = Null
    [Providers].Enabled = False
    [Providers] = Null
    [Number of Pages].Enabled = False
    [Number of Pages] = Null
    [Time].Enabled = False
    [Time] = Null
    [Cost].Enabled = False
    [Cost] = Null
    [Comments].Enabled = True
Else
        If [Outcome] = "Interpretation" Then
            [Date Provided].Enabled = True
            [Providers].Enabled = True
            [Number of Pages].Enabled = False
            [Number of Pages] = Null
            [Time].Enabled = True
            [Comments].Enabled = True
        Else
                If [Outcome] = "Translation" Then
                    [Date Provided].Enabled = True
                    [Providers].Enabled = True
                    [Number of Pages].Enabled = True
                    [Time].Enabled = True
                    [Comments].Enabled = True
                Else
                    [Date Provided].Enabled = False
                    [Date Provided] = Null
                    [Providers].Enabled = False
                    [Providers] = Null
                    [Number of Pages].Enabled = False
                    [Number of Pages] = Null
                    [Time].Enabled = False
                    [Time] = Null
                    [Cost].Enabled = False
                    [Cost] = Null
                    [Comments].Enabled = True
                End If
        End If
End If
End Sub
 
Do you have save button on your form? You could implement this and enable/disable the button depending on the criteria.
 
I do have a button, but it is a Macro. So I should convert it to vb and then do a lot of If...Then? That seems like a lot.

To get an idea of my form, the top half has around 9 controls whose fields are set to required in the table. These fields are like an intake, they have the client's information, language requested, date they want the service to be provided, etc. When the case is first entered, the "outcome" will be set to "pending" most of the time.

Later, after the service (interpretation/translation) is provided, we will pull up the case and change the "Outcome" status from pending to interpretation/translation/no service. The change in status then enables other textboxes that need to be entered. Right now, the form can be saved and closed with just the change of Outcome status without having the new enabled fields entered. I want to make sure the new enabled fields are also required to be filled before saving.

Thanks
 
I figured it out. I was looking at the macro for my button and came across the SetProperty... So in a round about way, Burrina, you helped me out, so thanks!
 
Last edited:
Glad you got it sorted out. Good Luck With Your Project!
 

Users who are viewing this thread

Back
Top Bottom