Results 1 to 4 of 4
  1. #1
    Ekhart is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    80

    Halting script with Case Else

    I have a multi-tiered case system set up. The first set is identifying the user. Is there a way that if a name not on the list is entered (this would fall under Case Else) to halt the script right there. I have a msgbox pop up but it also gives a code error when trying to run the remainder of the code.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Wouldn't it just be an IF,Then?
    Code:
    vUser =Dlookup(...)
    if IsNull(vUser) then
       MsgBox "not on file"
    else
       MsgBox "valid user"
    endif

  3. #3
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Just put Exit Sub after the Msgbox line.

  4. #4
    Ekhart is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    80
    Dang so easy Thanks John_G!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Change text case from upper to proper case
    By s.nolan in forum Access
    Replies: 1
    Last Post: 12-02-2015, 10:56 AM
  2. Replies: 3
    Last Post: 10-27-2014, 07:37 AM
  3. Case for in case field corrupt
    By Ruegen in forum Forms
    Replies: 9
    Last Post: 08-03-2014, 07:56 PM
  4. Replies: 5
    Last Post: 10-23-2012, 03:55 PM
  5. Database script
    By kleclark in forum Programming
    Replies: 2
    Last Post: 02-15-2011, 11:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums