Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665

    Unanswered: Ending a routine in the middle

    I have the following code:

    'Set Week Variables
    If Week_From_Combo = "Please Select Week" Or Week_To_Combo = "Please Select Week" Then
    TimeBox = MsgBox("Please Select a Time Range", vbOKOnly, "Unknown Time Period")
    End
    Else
    From_week = [Forms]![Form:_PCRKMS_Selection]![Week_From_Combo]
    to_week = " and " & [Forms]![Form:_PCRKMS_Selection]![Week_To_Combo]
    End If

    Now I would expect that if there is no time frame selected then the msg box will appear and the sub routine would then end.
    The msg box appears but then the routine continues. Now this is not a big deal except for the fact taht It needs to stop!!
    this code is the begging of a bit of code to populate a combo box. is that why the routine will not stop???
    Any Ideas would be nice
    Regards
    Jim

  2. #2
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    91
    If your routine is a Sub, you can just put "Exit Sub" there... If that's Function, just put "Exit Function".

  3. #3
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665
    I think that my problem was that i was trying to do this in the on focus of a combo, so the combo still tried to populate itself. I fixed it by putting combo.rowsource = "" after the if statment before the end statment.
    Thanx for the help
    Jim

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •