I am new to VBA and am having some problems turning several fields on a form off and then turning them. I was wondering if I might get some help with my code. I have a master form (frmSurveyType) with a combo box (cboSurveyType) with a tabbed sub form on it (sbfNestSurvey). When cboSurveyType = Land I want three fields (txtSitInNest, StandInNest, and EmptyNest) on the sbfNestSurvey to have the enable property to No and when cboSurveyType = Boat or Null these three fields to have the
enable property set to Yes. Here is my code. I have been able to disable the
fields but then I cannot enable them. I thank you in advance for any helpful
suggestions.
Private Sub sbfNestSurvey_Enter()
If Forms![frmSurveyType]![cboSurveyType] = "LAND"
Then
Forms![frmSurveyType]![sbfNestSurvey]![SitInNest].Enabled = No
Forms![frmSurveyType]![sbfNestSurvey]![StandInNest].Enabled = No
Forms![frmSurveyType]![sbfNestSurvey]![EmptyNest].Enabled = No
ElseIf
Forms![frmSurveyType]![cboSurveyType] = "BOAT" Then
Forms![frmSurveyType]![sbfNestSurvey]![SitInNest].Enabled = Yes
Forms![frmSurveyType]![sbfNestSurvey]![StandInNest].Enabled = Yes
Forms![frmSurveyType]![sbfNestSurvey]![EmptyNest].Enabled = Yes
ElseIf
Forms![frmSurveyType]![cboSurveyType] = Null Then
Forms![frmSurveyType]![sbfNestSurvey]![SitInNest].Enabled = Yes
Forms![frmSurveyType]![sbfNestSurvey]![StandInNest].Enabled = Yes
Forms![frmSurveyType]![sbfNestSurvey]![EmptyNest].Enabled = Yes
End If
End Sub
enable property set to Yes. Here is my code. I have been able to disable the
fields but then I cannot enable them. I thank you in advance for any helpful
suggestions.
Private Sub sbfNestSurvey_Enter()
If Forms![frmSurveyType]![cboSurveyType] = "LAND"
Then
Forms![frmSurveyType]![sbfNestSurvey]![SitInNest].Enabled = No
Forms![frmSurveyType]![sbfNestSurvey]![StandInNest].Enabled = No
Forms![frmSurveyType]![sbfNestSurvey]![EmptyNest].Enabled = No
ElseIf
Forms![frmSurveyType]![cboSurveyType] = "BOAT" Then
Forms![frmSurveyType]![sbfNestSurvey]![SitInNest].Enabled = Yes
Forms![frmSurveyType]![sbfNestSurvey]![StandInNest].Enabled = Yes
Forms![frmSurveyType]![sbfNestSurvey]![EmptyNest].Enabled = Yes
ElseIf
Forms![frmSurveyType]![cboSurveyType] = Null Then
Forms![frmSurveyType]![sbfNestSurvey]![SitInNest].Enabled = Yes
Forms![frmSurveyType]![sbfNestSurvey]![StandInNest].Enabled = Yes
Forms![frmSurveyType]![sbfNestSurvey]![EmptyNest].Enabled = Yes
End If
End Sub