Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Location
    Karachi
    Posts
    1

    Red face Unanswered: OuterJoin Query Not Running In Access

    The following query containing Left Outer Joins is running perfectly in SQL Server and returning the desired results as well.

    Select Users.UserCode, Users.LoginCode, Users.UserName, Users.Password, Users.LevelCode, Users.Active,
    Users.AllowPost, Users.Limit, Users.PostLimit, Users.UnitCode, Users.DepartmentCode,
    Users.MultiDepartmentLogin,
    Users.MultiBranchLogin,
    AccessLevel.LevelName as LevelName, Units.UnitName as UnitName,
    Departments.DepartmentName as DepartmentName,
    Users.UserType
    from Users Left outer join AccessLevel On Users.LevelCode = AccessLevel.LevelCode
    Left outer join Units on Users.unitCode = Units.unitCode
    Left outer join Departments on Users.DepartmentCode = Departments.DepartmentCode


    but when I copied and pasted this query to Access, then it generate a Syntax error

    Kindly tell what is the problem since as far I know queries in both SQl Server and Access support Left Outer Joins.

    Thank You,

    Imad Uddin
    Last edited by Imad Uddin; 10-22-03 at 14:27.

  2. #2
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450

    Exclamation enclosed in parentheses "(" & ")"

    Select Users.UserCode, Users.LoginCode, Users.UserName, Users.Password, Users.LevelCode, Users.Active,
    Users.AllowPost, Users.Limit, Users.PostLimit, Users.UnitCode, Users.DepartmentCode,
    Users.MultiDepartmentLogin,
    Users.MultiBranchLogin,
    AccessLevel.LevelName as LevelName, Units.UnitName as UnitName,
    Departments.DepartmentName as DepartmentName,
    Users.UserType

    from ((Users
    Left outer join AccessLevel On Users.LevelCode = AccessLevel.LevelCode)
    Left outer join Units on Users.unitCode = Units.unitCode )
    Left outer join Departments on Users.DepartmentCode = Departments.DepartmentCode

    after the from use as many parentheses as joins minus 1, starting at the top. So if you have 6 joins u have to use 5 opening parentheses and 5 closeing parentheses the last join never has parentheses

    Good Luck

Posting Permissions

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