+ Reply to Thread
Results 1 to 3 of 3

stopping a macro based on a conditional

  1. #1
    Craig
    Guest

    stopping a macro based on a conditional

    Maybe it's just been a long day, but I can't remember how I've done
    this in the past. I'm trying to have a macro stop based on a
    condition. It's coming from a form, but if things are done out of
    order in one spot, things go bad, so I'm trying to force the user into
    selecting a Week Beginning Date prior to checking a box. The week
    beginning date loads down to [Data!b2] so this macro is checking to see
    if there's anything there, if there is, it follows the code from there,
    if that cell is blank though, I want it to pop up a message, then
    return to the form (preferably without unloading and reloading the form
    as the user will lose all of their entries to that point). Any ideas?
    Here's what I've in this section now,

    If MultipleBox = True Then
    If [data!b2].Value = "" Then
    MsgBox "Choose Initial Request Week First"
    MultipleBox = False
    End Sub
    End If
    'From here the remainder of the code goes . . .


    Now I'm sure it's not end sub, but i can't remember what goes there -
    i've tried stop (does nothing) and end function (gives an error, then
    does nothing). Basically all i'm looking for is this, when the box is
    checked (this is in the MultipleBox_AfterUpdate) if it's true, check to
    see that the week beginning date has been selected, if that cell is
    blank - pop up a message - set the box back to unchecked - stop this
    macro while leaving the form running. Can someone point me back in the
    right direction?


  2. #2
    Registered User
    Join Date
    01-19-2005
    Posts
    27
    im really new to VBA, but are you refering to "Exit Sub"? Not sure if this will close the form.

  3. #3
    Ken Hudson
    Guest

    RE: stopping a macro based on a conditional

    How about "Exit Sub"?
    --
    Ken Hudson


    "Craig" wrote:

    > Maybe it's just been a long day, but I can't remember how I've done
    > this in the past. I'm trying to have a macro stop based on a
    > condition. It's coming from a form, but if things are done out of
    > order in one spot, things go bad, so I'm trying to force the user into
    > selecting a Week Beginning Date prior to checking a box. The week
    > beginning date loads down to [Data!b2] so this macro is checking to see
    > if there's anything there, if there is, it follows the code from there,
    > if that cell is blank though, I want it to pop up a message, then
    > return to the form (preferably without unloading and reloading the form
    > as the user will lose all of their entries to that point). Any ideas?
    > Here's what I've in this section now,
    >
    > If MultipleBox = True Then
    > If [data!b2].Value = "" Then
    > MsgBox "Choose Initial Request Week First"
    > MultipleBox = False
    > End Sub
    > End If
    > 'From here the remainder of the code goes . . .
    >
    >
    > Now I'm sure it's not end sub, but i can't remember what goes there -
    > i've tried stop (does nothing) and end function (gives an error, then
    > does nothing). Basically all i'm looking for is this, when the box is
    > checked (this is in the MultipleBox_AfterUpdate) if it's true, check to
    > see that the week beginning date has been selected, if that cell is
    > blank - pop up a message - set the box back to unchecked - stop this
    > macro while leaving the form running. Can someone point me back in the
    > right direction?
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1