Results 1 to 3 of 3
  1. #1
    jj1 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2014
    Posts
    128

    Else WITHOUT IF Compile error

    Private Sub WasIssueResolved_Click()
    On Error Resume Next
    If WasIssueResolved = True Then
    Forms!UnsafeAct!CloseDate.Visible = True
    CloseDate.Locked = True


    ' If IsNull(Me![ActionTakenBy PersonResponsible]) Then
    ' MsgBox "You must provide details of the Action Taken By Person Responsible.", vbOKOnly, "More Data Required!"
    ' Exit Sub
    End If

    Else
    Forms!UnsafeAct!CloseDate.Visible = False
    CloseDate.Locked = False
    End If

    End Sub


    I am compiling this database and I don't know why I am getting Else without If compile error

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    You have too many ELSEs or too many END IF. loose the endif in red

    If WasIssueResolved = True Then
    Forms!UnsafeAct!CloseDate.Visible = True
    CloseDate.Locked = True
    End If

    Else
    Forms!UnsafeAct!CloseDate.Visible = False
    CloseDate.Locked = False
    End If

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    Remove all yours above for simpler code:

    Code:
    Forms!UnsafeAct!CloseDate.Visible = WasIssueResolved
    CloseDate.Locked = WasIssueResolved

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

Similar Threads

  1. Replies: 7
    Last Post: 07-24-2013, 02:01 PM
  2. Compile Error: Syntax Error in DoCmd.RunSQL Statement
    By Evilferret in forum Programming
    Replies: 1
    Last Post: 08-27-2012, 12:32 PM
  3. Replies: 2
    Last Post: 06-23-2012, 11:59 PM
  4. Replies: 7
    Last Post: 06-08-2012, 09:55 PM
  5. Replies: 6
    Last Post: 09-28-2011, 09:20 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