I wrote the code below in order to navigate through a form named "Production Board Data Input". I wrote this code so that I could skip some inputs based upon the Dept or Location input - dont need the all data fields for all Dept selections, but want to capture department and man-hours at a minimum. I ONLY want to enable Shift_input, total_manhours and HPO_input when I select "Maintenance". When I do select "Maintenance" from my Dept_or_location drop down menu, ALL form fields are enabled. What am I doing wrong? Similar issue when I select "Shipping". Thanks.
Private Sub Dept_or_Location_beforeupdate(Cancel As Integer)
With Me
Select Case Me.Dept_or_Location
Case "Maintenance"
.Shift_input.Enabled = True
.Date.Enabled = True
.Total_Good_pcs.Enabled = False
.Total_Reject_or_Scrap.Enabled = False
.Total_Manhours.Enabled = True
.HPO_input.Enabled = False
Case "Shipping"
.Shift_input.Enabled = True
.Date.Enabled = True
.Total_Good_pcs.Enabled = True
.Total_Reject_or_Scrap.Enabled = False
.Total_Manhours.Enabled = True
.HPO_input.Enabled = True
Case "Rough Inspection"
.Shift_input.Enabled = True
.Date.Enabled = True
.Total_Good_pcs.Enabled = True
.Total_Reject_or_Scrap.Enabled = True
.Total_Manhours.Enabled = True
.HPO_input.Enabled = True
Case "Final Finish"
.Shift_input.Enabled = True
.Date.Enabled = True
.Total_Good_pcs.Enabled = True
.Total_Reject_or_Scrap.Enabled = True
.Total_Manhours.Enabled = True
Case "Setup"
.Shift_input.Enabled = True
.Date.Enabled = True
.Total_Good_pcs.Enabled = True
.Total_Reject_or_Scrap.Enabled = True
.Total_Manhours.Enabled = True
End Select
End With
End Sub
Private Sub Dept_or_Location_beforeupdate(Cancel As Integer)
With Me
Select Case Me.Dept_or_Location
Case "Maintenance"
.Shift_input.Enabled = True
.Date.Enabled = True
.Total_Good_pcs.Enabled = False
.Total_Reject_or_Scrap.Enabled = False
.Total_Manhours.Enabled = True
.HPO_input.Enabled = False
Case "Shipping"
.Shift_input.Enabled = True
.Date.Enabled = True
.Total_Good_pcs.Enabled = True
.Total_Reject_or_Scrap.Enabled = False
.Total_Manhours.Enabled = True
.HPO_input.Enabled = True
Case "Rough Inspection"
.Shift_input.Enabled = True
.Date.Enabled = True
.Total_Good_pcs.Enabled = True
.Total_Reject_or_Scrap.Enabled = True
.Total_Manhours.Enabled = True
.HPO_input.Enabled = True
Case "Final Finish"
.Shift_input.Enabled = True
.Date.Enabled = True
.Total_Good_pcs.Enabled = True
.Total_Reject_or_Scrap.Enabled = True
.Total_Manhours.Enabled = True
Case "Setup"
.Shift_input.Enabled = True
.Date.Enabled = True
.Total_Good_pcs.Enabled = True
.Total_Reject_or_Scrap.Enabled = True
.Total_Manhours.Enabled = True
End Select
End With
End Sub