Results 1 to 4 of 4
  1. #1
    Mclaren is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2010
    Location
    Johannesburg
    Posts
    164

    select case problem

    i have the code as below, which to me seems fine, but when i run the code, i get a "Else without If" error....what gives ? i am stumped :



    Code:
    Private Sub User_AfterUpdate()
    
        'check to see if check box is marked
        If Me.User = True Then
        
            'check to see if password exists
            If Me.UserPassword = "" Then
            
            'if no password then ask user if they would like to set password or not ?
            Select Case MsgBox("There is no password set. Continue ?", vbYesNo, "notice...")
                'if yes, set temp passowrd and inform user therof
                Case vbYes
                    strMsg = "A temporary password has been set of:" & vbCrLf & _
                        "PASSWORD" & vbCrLf & _
                        " " & vbCrLf & _
                        "This passowrd must be changed at first login"
                    MsgBox strMsg
                    Me.UserPassword = "PASSWORD"
                    Exit Sub
                Case vbNo
                    'if no display message and set user to false
                    MsgBox "User cannot be set without a passord", vbOKOnly, "Notice"
                    Me.User = False
            Else
            End If
        End If
    
    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    There's no

    End Select

    to close off the Select Case statement.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Mclaren is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2010
    Location
    Johannesburg
    Posts
    164
    Thanks Paul.

    Cannot believe i missed that.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem. We all experience bouts of blindness now and then.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. select case or else if for unhiding
    By nichmeg in forum Programming
    Replies: 3
    Last Post: 10-30-2011, 09:30 AM
  2. Select Case vs Dlookup
    By BRV in forum Programming
    Replies: 1
    Last Post: 10-28-2011, 03:18 PM
  3. Select Case using query field
    By focosi in forum Programming
    Replies: 4
    Last Post: 08-15-2011, 11:00 AM
  4. Help with Select Case statement
    By focosi in forum Access
    Replies: 4
    Last Post: 08-09-2011, 12:01 AM
  5. Replies: 3
    Last Post: 05-06-2011, 02:49 PM

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