So i wrote out this code and it works how i want but I know there HAS to be a better way to do this? I am new to coding so I am hoping to learn something from this. Please do not tell me to restructure my database.
I want the code to check cboQuestion5 to see if the value is (Showtunes, Other Earworm, Pop, Country, Rock, OR Standards). If it is not one of those values, prompt the user with the Yes No message box and if no is selected exit the sub. It should also check cboHard5 to see if the value is not Vocabulary. If it is notprompt the user with the Yes No message box and if no is selected exit the sub.
Code:
If (Me.cboQuestion5) <> "Showtunes" Then GoTo Next1 Else GoTo HardCheck
Next1:
If (Me.cboQuestion5) <> "Other Earworm" Then GoTo Next2 Else GoTo HardCheck
Next2:
If (Me.cboQuestion5) <> "Pop" Then GoTo Next3 Else GoTo HardCheck
Next3:
If (Me.cboQuestion5) <> "Country" Then GoTo Next4 Else GoTo HardCheck
Next4:
If (Me.cboQuestion5) <> "Rock" Then GoTo Next5 Else GoTo HardCheck
Next5:
If (Me.cboQuestion5) <> "Standards" Then
MsgBoxResult = MsgBox("Easy Round Category 5 is NOT an Ear Worm Question. Are you sure?", vbYesNo, "EAR WORM QUESTION")
If MsgBoxResult = vbNo Then
Me.cboQuestion5.SetFocus
Exit Sub
ElseIf MsgBoxResult = vbYes Then
End If
End If
HardCheck:
If ((Me.cboHard5) <> "Vocabulary") Then
MsgBoxResult = MsgBox("Hard Round Category 5 is NOT a Vocabulary Question. Are you sure?", vbYesNo, "VOCABULARY QUESTION")
If MsgBoxResult = vbNo Then
Me.cboHard5.SetFocus
Exit Sub
ElseIf MsgBoxResult = vbYes Then
End If
End If