Hi,
I have several forms that have the same option group on them that do the same thing. I want to create a public function so I would not have to have all the code listed below on all the forms. There are 5 options and if you click one the others would go back to there default settings. The code would have to do this when the buttons are clicked. Also there is other code that can change the options without having the option clicked. ie if a date is older than the current date then change the option to nmcm and then perform all the actions that would happen if you had clicked the option.
thanks for the help.
If Me.STATUS = "FMC" Then
Me.optionStatus.value = 1
Me.optionStatus.BackColor = rgb(0, 250, 12)
Me.togFMC.ForeColor = 16711680
Me.togPMCM.ForeColor = rgb(255, 255, 0)
Me.togPMCS.ForeColor = rgb(255, 255, 0)
Me.togNMCM.ForeColor = rgb(255, 0, 0)
Me.togNMCS.ForeColor = rgb(255, 0, 0)
ElseIf Me.STATUS = "NMCM" Then
Me.optionStatus.value = 4
Me.optionStatus.BackColor = rgb(255, 0, 0)
Me.togFMC.ForeColor = rgb(0, 153, 0)
Me.togPMCM.ForeColor = rgb(255, 255, 0)
Me.togPMCS.ForeColor = rgb(255, 255, 0)
Me.togNMCM.ForeColor = 16711680
Me.togNMCS.ForeColor = rgb(255, 0, 0)
ElseIf Me.STATUS = "NMCS" Then
Me.optionStatus.value = 5
Me.optionStatus.BackColor = rgb(255, 0, 0)
Me.togFMC.ForeColor = rgb(0, 153, 0)
Me.togPMCM.ForeColor = rgb(255, 255, 0)
Me.togPMCS.ForeColor = rgb(255, 255, 0)
Me.togNMCM.ForeColor = rgb(255, 0, 0)
Me.togNMCS.ForeColor = 16711680
ElseIf Me.STATUS = "PMCM" Then
Me.optionStatus.value = 2
Me.optionStatus.BackColor = rgb(255, 255, 0)
Me.togFMC.ForeColor = rgb(0, 153, 0)
Me.togPMCM.ForeColor = 16711680
Me.togPMCS.ForeColor = rgb(255, 255, 0)
Me.togNMCM.ForeColor = rgb(255, 0, 0)
Me.togNMCS.ForeColor = rgb(255, 0, 0)
ElseIf Me.STATUS = "PMCS" Then
Me.optionStatus.value = 3
Me.optionStatus.BackColor = rgb(255, 255, 0)
Me.togFMC.ForeColor = rgb(0, 153, 0)
Me.togPMCM.ForeColor = rgb(255, 255, 0)
Me.togPMCS.ForeColor = 16711680
Me.togNMCM.ForeColor = rgb(255, 0, 0)
Me.togNMCS.ForeColor = rgb(255, 0, 0)
ElseIf Me.STATUS = "n/a" Or IsNull(Me.STATUS) Then
Me.optionStatus.value = 0
Me.optionStatus.BackColor = rgb(0, 0, 0)
Me.togFMC.ForeColor = rgb(0, 153, 0)
Me.togPMCM.ForeColor = rgb(255, 255, 0)
Me.togPMCS.ForeColor = rgb(255, 255, 0)
Me.togNMCM.ForeColor = rgb(255, 0, 0)
Me.togNMCS.ForeColor = rgb(255, 0, 0)
End If
I have several forms that have the same option group on them that do the same thing. I want to create a public function so I would not have to have all the code listed below on all the forms. There are 5 options and if you click one the others would go back to there default settings. The code would have to do this when the buttons are clicked. Also there is other code that can change the options without having the option clicked. ie if a date is older than the current date then change the option to nmcm and then perform all the actions that would happen if you had clicked the option.
thanks for the help.
If Me.STATUS = "FMC" Then
Me.optionStatus.value = 1
Me.optionStatus.BackColor = rgb(0, 250, 12)
Me.togFMC.ForeColor = 16711680
Me.togPMCM.ForeColor = rgb(255, 255, 0)
Me.togPMCS.ForeColor = rgb(255, 255, 0)
Me.togNMCM.ForeColor = rgb(255, 0, 0)
Me.togNMCS.ForeColor = rgb(255, 0, 0)
ElseIf Me.STATUS = "NMCM" Then
Me.optionStatus.value = 4
Me.optionStatus.BackColor = rgb(255, 0, 0)
Me.togFMC.ForeColor = rgb(0, 153, 0)
Me.togPMCM.ForeColor = rgb(255, 255, 0)
Me.togPMCS.ForeColor = rgb(255, 255, 0)
Me.togNMCM.ForeColor = 16711680
Me.togNMCS.ForeColor = rgb(255, 0, 0)
ElseIf Me.STATUS = "NMCS" Then
Me.optionStatus.value = 5
Me.optionStatus.BackColor = rgb(255, 0, 0)
Me.togFMC.ForeColor = rgb(0, 153, 0)
Me.togPMCM.ForeColor = rgb(255, 255, 0)
Me.togPMCS.ForeColor = rgb(255, 255, 0)
Me.togNMCM.ForeColor = rgb(255, 0, 0)
Me.togNMCS.ForeColor = 16711680
ElseIf Me.STATUS = "PMCM" Then
Me.optionStatus.value = 2
Me.optionStatus.BackColor = rgb(255, 255, 0)
Me.togFMC.ForeColor = rgb(0, 153, 0)
Me.togPMCM.ForeColor = 16711680
Me.togPMCS.ForeColor = rgb(255, 255, 0)
Me.togNMCM.ForeColor = rgb(255, 0, 0)
Me.togNMCS.ForeColor = rgb(255, 0, 0)
ElseIf Me.STATUS = "PMCS" Then
Me.optionStatus.value = 3
Me.optionStatus.BackColor = rgb(255, 255, 0)
Me.togFMC.ForeColor = rgb(0, 153, 0)
Me.togPMCM.ForeColor = rgb(255, 255, 0)
Me.togPMCS.ForeColor = 16711680
Me.togNMCM.ForeColor = rgb(255, 0, 0)
Me.togNMCS.ForeColor = rgb(255, 0, 0)
ElseIf Me.STATUS = "n/a" Or IsNull(Me.STATUS) Then
Me.optionStatus.value = 0
Me.optionStatus.BackColor = rgb(0, 0, 0)
Me.togFMC.ForeColor = rgb(0, 153, 0)
Me.togPMCM.ForeColor = rgb(255, 255, 0)
Me.togPMCS.ForeColor = rgb(255, 255, 0)
Me.togNMCM.ForeColor = rgb(255, 0, 0)
Me.togNMCS.ForeColor = rgb(255, 0, 0)
End If