unexpected end of statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rcollins
    New Member
    • Aug 2006
    • 234

    unexpected end of statement

    I was changing a few things in my database when I came across this error, doesn't like my code when I am trying to use the comma to seperate the last ans first name, thinks i am at the end of a line. How can I fix this? Thanks
    Code:
    Private Sub Check76_AfterUpdate()
        If Me!Check76 Then    'is true
            Me.List26.RowSource = "SELECT tblStaff.ID, [LastName] & ", " & [FirstName] AS Expr1, tblStaff.FirstName, IIf(tblStaff.Current,'Yes','No') AS txtIsStaffCurrent FROM tblStaff ORDER BY tblStaff.LastName;"
        Else
            Me.List26.RowSource = "SELECT tblStaff.ID, [LastName] & ", " & [FirstName] AS Expr1, tblStaff.FirstName, IIf(tblStaff.Current,'Yes','No') AS txtIsStaffCurrent WHERE (((tblStaff.Current) = True)) ORDER BY tblStaff.LastName;"
         End If
    End Sub
  • nspader
    New Member
    • Mar 2008
    • 78

    #2
    Originally posted by rcollins
    I was changing a few things in my database when I came across this error, doesn't like my code when I am trying to use the comma to seperate the last ans first name, thinks i am at the end of a line. How can I fix this? Thanks
    Code:
    Private Sub Check76_AfterUpdate()
        If Me!Check76 Then    'is true
            Me.List26.RowSource = "SELECT tblStaff.ID, [LastName] & ", " & [FirstName] AS Expr1, tblStaff.FirstName, IIf(tblStaff.Current,'Yes','No') AS txtIsStaffCurrent FROM tblStaff ORDER BY tblStaff.LastName;"
        Else
            Me.List26.RowSource = "SELECT tblStaff.ID, [LastName] & ", " & [FirstName] AS Expr1, tblStaff.FirstName, IIf(tblStaff.Current,'Yes','No') AS txtIsStaffCurrent WHERE (((tblStaff.Current) = True)) ORDER BY tblStaff.LastName;"
         End If
    End Sub
    I am also New at Access VBA but I believe you want to change your double quotes (") inside double quotes (") to a single quote ( ' ) on either side. That should work for you.

    Nick

    Comment

    • rcollins
      New Member
      • Aug 2006
      • 234

      #3
      Worked perfect, thank you

      Comment

      Working...