Results 1 to 3 of 3

Thread: Query problem

  1. #1
    Lounger
    Join Date
    Sep 2005
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    this is the code i am running......

    cusVar = "SELECT Workorders.WorkorderNo AS [Work Order #], [Work Type].WorkTypeDescription AS [Work Type], WorkStatus.WorkStatus AS [Work Status], Workorders.ProblemDescription AS [Problem Description], Workorders.GeneralDescription, Workorders.EmployeeID2 AS [Assigned To], Employees.FirstName AS Requester, Workorders.ActionTaken, workpriority.WorkPriority AS [Work Priority], Workorders.DateReceived AS [Received Date], Employees.WorkPhone AS [Office Phone], Employees.HandPhone AS [Mobile Phone], location.LocationDescription AS [Location Description], Workorders.EstDateStart " & _
    "FROM ((((((Workorders LEFT JOIN [Work Type] ON Workorders.WorkType = [Work Type].WorkTypeID) LEFT JOIN WorkStatus ON Workorders.WorkStatus = WorkStatus.WorkStatusID) LEFT JOIN location ON Workorders.LocationNo = location.LocationNo) LEFT JOIN workpriority ON Workorders.WorkPriority = workpriority.WorkPriorityID) LEFT JOIN [failure cause] ON Workorders.FailureCauseCode = [failure cause].[Failure Cause Code]) LEFT JOIN Employees ON Workorders.RequestorNo = Employees.EmployeeNO) "


    when i debug to see why it is not working the query gets broken like this (the word Requestor gets split)........

    SELECT Workorders.WorkorderNo AS [Work Order #], [Work Type].WorkTypeDescription AS [Work Type], WorkStatus.WorkStatus AS [Work Status], Workorders.ProblemDescription AS [Problem Description], Workorders.GeneralDescription, Workorders.EmployeeID2 AS [Assigned To], Employees.FirstName AS Requester, Workorders.ActionTaken, workpriority.WorkPriority AS [Work Priority], Workorders.DateReceived AS [Received Date], Employees.WorkPhone AS [Office Phone], Employees.HandPhone AS [Mobile Phone], location.LocationDescription AS [Location Description], Workorders.EstDateStart FROM ((((((Workorders LEFT JOIN [Work Type] ON Workorders.WorkType = [Work Type].WorkTypeID) LEFT JOIN WorkStatus ON Workorders.WorkStatus = WorkStatus.WorkStatusID) LEFT JOIN location ON Workorders.LocationNo = location.LocationNo) LEFT JOIN workpriority ON Workorders.WorkPriority = workpriority.WorkPriorityID) LEFT JOIN [failure cause] ON Workorders.FailureCauseCode = [failure cause].[Failure Cause Code]) LEFT JOIN Employees ON Workorders.Request
    orNo = Employees.EmployeeNO)

    can someone tell me what i am doing wrong???

    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    The SQL is more than 1,024 characters. Does this work better? It uses aliases to shorten the string.

    cusVar = "SELECT wo.WorkorderNo AS [Work Order #], wt.WorkTypeDescription AS [Work Type], ws.WorkStatus AS [Work Status], wo.ProblemDescription AS [Problem Description], wo.GeneralDescription, wo.EmployeeID2 AS [Assigned To], e.FirstName AS Requester, wo.ActionTaken, wp.WorkPriority AS [Work Priority], wo.DateReceived AS [Received Date], e.WorkPhone AS [Office Phone], e.HandPhone AS [Mobile Phone], l.LocationDescription AS [Location Description], wo.EstDateStart " & _
    "FROM ((((((Workorders AS wo LEFT JOIN [Work Type] AS wt ON wo.WorkType = wt.WorkTypeID) LEFT JOIN WorkStatus AS ws ON wo.WorkStatus = ws.WorkStatusID) LEFT JOIN location AS l ON wo.LocationNo = l.LocationNo) LEFT JOIN workpriority AS wp ON wo.WorkPriority = wp.WorkPriorityID) LEFT JOIN [failure cause] AS fc ON wo.FailureCauseCode = fc.[Failure Cause Code]) LEFT JOIN Employees As e ON wo.RequestorNo = e.EmployeeNO)"

    If not, design the query interactively, then switch to SQL view and copy the SQL string.

  3. #3
    Lounger
    Join Date
    Sep 2005
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i will have to try this in the morning....thanks for your help. I was wondering if there was a limit to the length.

Posting Permissions

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