Auto populate form based on Combo box choice

ramez75

Registered User.
Local time
Today, 08:50
Joined
Dec 23, 2008
Messages
181
I have a form which is used to populate a table. The form is made up of 7 fields/combo boxes style. Each combo box has its own table as "Control source". All the combo boxes have "Not Applicable" as a choice to be selected with the exception of Combo Box 1 which have only Yes and No.

My problem is to save time for the user and to complete the form quicker and instead of going through each combo box to select a value, I want to do the following:

Field 1 on the form = Combo box 1 have 2 choices YES or NO. If the user selects "YES" I want the other 6 fields/combo boxes to be populated with "Not Applicable" instead of the user having to go into each combo box and select "Not Applicable".

Where as if the user select "NO" then they just go and complete each field / combo box on the form separately by choosing the appropriate value from the combo box.

Below is what I was trying but nothing happens

Code:
Private Sub Form_AfterUpdate()
If Me.ObservationSafeAction.Value = "Yes" Then
Me.WhatUnsafe.Value = "Not Applicable"
Me.UnsafeCondition.Value = "Not Applicable"
Me.Communicationissues.Value = "Not Applicable"
Me.RepetitiveMotion.Value = "Not Applicable"
Me.FacilitiesEquipToolsIssue.Value = "Not Applicable"
Me.Management.Value = "Not Applicable"
End If
End Sub

Hope I didnt confuse anyone and explained my problem clearly

Thanks in advance
 
Attached is a copy of the trial database. As you can see in the form my intention is when the user select "Yes" from "Was the Observation Safe?" I want all other fields in the form to auto populate with "Not Applicable" with the exception of "What was Safe about your observation?" in that way I will save the user time to go and select " Not Applicable" from all the other fields

Thank you
 

Attachments

I dont have SQL, unless I am misunderstanding the question. All I have is what is in the attached database
 
I figured it out, dont know if this is the best approach but it does what I have in mind

Code:
Private Sub Combo27_AfterUpdate()
If Me.Combo27 = "Yes" Then
    Me.Combo33 = "Not Applicable"
    Me.Combo36 = "Not Applicable"
    Me.Combo39 = "Not Applicable"
    Me.Combo42 = "Not Applicable"
    Me.Combo45 = "Not Applicable"
    Me.Combo48 = "Not Applicable"
End If
End Sub
 
I also used the below in that way the user will have to fill the enabled fields

Code:
Private Sub Combo27_AfterUpdate()
If Me.Combo27 = "Yes" Then
    Me.Combo33 = "Not Applicable"
    Me.Combo33.Enabled = False
    Me.Combo36 = "Not Applicable"
    Me.Combo36.Enabled = False
    Me.Combo39 = "Not Applicable"
    Me.Combo39.Enabled = False
    Me.Combo42 = "Not Applicable"
    Me.Combo42.Enabled = False
    Me.Combo45 = "Not Applicable"
    Me.Combo45.Enabled = False
    Me.Combo48 = "Not Applicable"
    Me.Combo48.Enabled = False
Else
    Me.Combo33 = ""
    Me.Combo33.Enabled = True
    Me.Combo36 = ""
    Me.Combo36.Enabled = True
    Me.Combo39 = ""
    Me.Combo39.Enabled = True
    Me.Combo42 = ""
    Me.Combo42.Enabled = True
    Me.Combo45 = ""
    Me.Combo45.Enabled = True
    Me.Combo48 = ""
    Me.Combo48.Enabled = True
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom