Results 1 to 3 of 3
  1. #1
    RunTime91 is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2014
    Posts
    284

    Transferring SQL over to Access VBE pulls NULL set

    Greetings All...

    The below code works perfectly in SQL '14
    Code:
    SELECT MgrName As Supervisor, COUNT(C.Assoc_ID) AS TtlAgents, SUM(CASE WHEN (Status = 'Completed') THEN 1 ELSE 0 END) As TtlCmpltd FROM
    	  (SELECT MgrName, Assoc_ID, Full_Nm, IIf(AssocName = Full_Nm,'Completed','Not Completed') As Status FROM
    		(SELECT MgrName, Assoc_ID, Full_Nm FROM Tri.vAssocView WHERE MgrName In ('Serb, James','Carrasco, Joyce','Nemeth, Annie','Steffensrud, Janelle',
    					'Sharp Garcia, Stacey','Lopez, Stacie') GROUP BY MgrName, Assoc_ID, Full_Nm) A
    			LEFT JOIN
    		(SELECT AssocID, AssocName  FROM Tri.OneonOne WHERE DateOfReview >'1/31/2020' GROUP BY AssocID, AssocName) B
    	ON A.Assoc_ID = B.AssocID) C
    	GROUP BY MgrName
    The below adaptation to the Access VBE - pulls a NULL set - I've done this many, many times - What am I not seeing??


    Code:
    LstSQL = "SELECT MgrName As Supervisor, COUNT(C.Assoc_ID) AS TtlAgents, SUM(CASE WHEN (Status = 'Completed') THEN 1 ELSE 0 END) As TtlCmpltd FROM " & _
                        "(SELECT MgrName, Assoc_ID, Full_Nm, IIf(AssocName = Full_Nm,'Completed','Not Completed') As Status FROM " & _
                          "(SELECT MgrName, Assoc_ID, Full_Nm FROM Tri_vAssocView WHERE MgrName In ('Serb, James', 'Carrasco, Joyce', 'Nemeth, Annie', 'Steffensrud, Janelle', " & _
                            "'Sharp Garcia, Stacey', 'Lopez, Stacie') GROUP BY MgrName, Assoc_ID, Full_Nm) A " & _
                            "LEFT JOIN " & _
                          "(SELECT AssocID, AssocName  FROM Tri_OneonOne WHERE DateOfReview > '1/31/2020' GROUP BY AssocID, AssocName) B " & _
                      "ON A.Assoc_ID = B.AssocID) C " & _
                      "GROUP BY MgrName"
    Thank You as always!!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,643
    Have you adapted SQL using CASE before? Access SQL engine does not acknowledge CASE.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    RunTime91 is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2014
    Posts
    284
    OMG... Nope! Never have - LOL!! Houston! I believe we have identified our problem..

    June - You're amazing!! Thank You So Much!!

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

Similar Threads

  1. Replies: 5
    Last Post: 02-27-2017, 04:05 PM
  2. Replies: 2
    Last Post: 08-27-2014, 12:12 PM
  3. Transferring Excel Sheet To Access
    By athyeh in forum Access
    Replies: 22
    Last Post: 07-26-2013, 02:18 PM
  4. Replies: 10
    Last Post: 08-21-2012, 07:16 AM
  5. transferring data from word to access
    By RickScolaro in forum Access
    Replies: 6
    Last Post: 09-08-2011, 05:17 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