Hello folks-
I have a question about using "select case"
I would like to use the code below to change the color of a textbox (text59) based on the combo box (Status) text. It works well, but I have other textboxes and combo boxes that I would like to perform the same. Is there a way to loop this for other controls using the same on open event? Cheers to anyone willing to help! -Tom
Private Sub form_Open()
Select Case Me.[Status]
Case Is = "Completed study"
Forms!mainsubform!Text59.BackColor = vbGreen
Case Is = "Dropped from study"
Forms!mainsubform!Text59.BackColor = vbRed
Case Is = "Rejected"
Forms!mainsubform!Text59.BackColor = 65535
Case Else
Forms!mainsubform!Text59.BackColor = 16777215
End Select
I have a question about using "select case"
I would like to use the code below to change the color of a textbox (text59) based on the combo box (Status) text. It works well, but I have other textboxes and combo boxes that I would like to perform the same. Is there a way to loop this for other controls using the same on open event? Cheers to anyone willing to help! -Tom
Private Sub form_Open()
Select Case Me.[Status]
Case Is = "Completed study"
Forms!mainsubform!Text59.BackColor = vbGreen
Case Is = "Dropped from study"
Forms!mainsubform!Text59.BackColor = vbRed
Case Is = "Rejected"
Forms!mainsubform!Text59.BackColor = 65535
Case Else
Forms!mainsubform!Text59.BackColor = 16777215
End Select