ok, basically i want this piece of code to take in two variables (strDay and strPeriod) run the case statement and then return the updated version of strDay and strPeriod... confused? read on
Code:Public Function NextPeriod(strDay As String, strPeriod As String) Select Case strDay Case "Friday" If strPeriod = "Period6" Then strPeriod = "finished" If strPeriod = "Period5" Then strPeriod = "Period6" If strPeriod = "Period4" Then strPeriod = "Period5" If strPeriod = "Period3" Then strPeriod = "Period4" If strPeriod = "Period2" Then strPeriod = "Period3" If strPeriod = "Period1" Then strPeriod = "Period2" Case "Thursday" If strPeriod = "Period6" Then strDay = "Friday": strPeriod = "temp" If strPeriod = "Period5" Then strPeriod = "Period6" If strPeriod = "Period4" Then strPeriod = "Period5" If strPeriod = "Period3" Then strPeriod = "Period4" If strPeriod = "Period2" Then strPeriod = "Period3" If strPeriod = "Period1" Then strPeriod = "Period2" If strPeriod = "temp" Then strPeriod = "Period1" Case "Wednesday" If strPeriod = "Period6" Then strDay = "Thursday": strPeriod = "temp" If strPeriod = "Period5" Then strPeriod = "Period6" If strPeriod = "Period4" Then strPeriod = "Period5" If strPeriod = "Period3" Then strPeriod = "Period4" If strPeriod = "Period2" Then strPeriod = "Period3" If strPeriod = "Period1" Then strPeriod = "Period2" If strPeriod = "temp" Then strPeriod = "Period1" Case "Tuesday" If strPeriod = "Period6" Then strDay = "Wednesday": strPeriod = "temp" If strPeriod = "Period5" Then strPeriod = "Period6" If strPeriod = "Period4" Then strPeriod = "Period5" If strPeriod = "Period3" Then strPeriod = "Period4" If strPeriod = "Period2" Then strPeriod = "Period3" If strPeriod = "Period1" Then strPeriod = "Period2" If strPeriod = "temp" Then strPeriod = "Period1" Case "Monday" If strPeriod = "Period6" Then strDay = "Tuesday": strPeriod = "temp" If strPeriod = "Period5" Then strPeriod = "Period6" If strPeriod = "Period4" Then strPeriod = "Period5" If strPeriod = "Period3" Then strPeriod = "Period4" If strPeriod = "Period2" Then strPeriod = "Period3" If strPeriod = "Period1" Then strPeriod = "Period2" If strPeriod = "temp" Then strPeriod = "Period1" End Select MsgBox "" & strPeriod & " and " & strDay & "" End Function Public Sub test() strPeriod = "Period1" strDay = "Monday" Call NextPeriod("Monday", "Period1") MsgBox "" & strPeriod & " and " & strDay & "" End Sub
ok, basically the strPeriod and strDay from the NextPeriod function are updated (in this case to Period2 and Monday), but the values are not updated in the 'test' subform...
so basically, i dont know what i'm doing in VB but i know what i want to do, and i'm not sure how - i'm obviously going about this completely wrong...
any help is appreciated
mark