Results 1 to 3 of 3

Thread: CrossTab Query in Access report

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    152

    Exclamation CrossTab Query in Access report

    Hi all,

    i have genrated one CrossTab Query in Access which show me out put as

    ProductName 1 L 1.86 L 2 L 2.5 L 3.87 L
    ---------------------------------------------------------------------
    Herbal Botannical Drink 26 -- -- -- --
    Herbal Botannical Drink 26 -- -- -- --
    COMPV Fieldberry Drink 4
    COMPV Fruit Punch Drink 4
    COMPV Lite Fruit Punch Drink 0


    i bind it on one reports it show me all records for all customer i want to show only related reords for that customreID one saprate pages..
    my query is as follows ..

    VB Code:
    1. "TRANSFORM Sum(OrderDetails.RequestedQty) AS SumOfRequestedQty
    2. SELECT OrderDetails.ProductName
    3. FROM ((Customers INNER JOIN OrderHeaders ON Customers.CustomerID = OrderHeaders.CustomerID) INNER JOIN Products ON Customers.CustomerID = Products.CustomerID) INNER JOIN OrderDetails ON OrderHeaders.OrderNbr = OrderDetails.OrderNbr
    4. GROUP BY Products.Size, Customers.CustomerID, OrderHeaders.OrderNbr, OrderDetails.OrderItemNbr, OrderDetails.ProductName, Customers.CompanyName
    5. PIVOT OrderDetails.Size;"



    How can i do this ??

    also i want to display the value zero if no data is present for that filed

    pls help me regarding this .
    thanx and regards,
    Nilesh Thakur.

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    152

    Re: CrossTab Query in Access report

    come on pls help me...
    Nilesh Thakur.

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: CrossTab Query in Access report

    You can use an IIF statement in your sql query to evaluate if it is null replace it with a "0".
    VB Code:
    1. IIF(IsNull([OrderDetails].[Size]), 0, [OrderDetails].[Size])
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

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



Click Here to Expand Forum to Full Width