+ Reply to Thread
Results 1 to 2 of 2

Getting data using MS Query

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-12-2007
    Posts
    144

    Getting data using MS Query

    Hi,
    I have created a query in Access and am trying to get MS Query to use the SQL to get data into my spreadsheet.
    It works fine in Access and I cannot for the life of me figure out what the problem is in MS Query!

    It says "Too few parameters. Expected 3."

    SELECT `Ahr1002-AUS`.`Order Sales Rep`, `Ahr1002-AUS`.`Sales Order`, `Ahr1002-AUS`.`Delivery Date`, `Ahr1002-AUS`.`Line Status`, `Ahr1002-AUS`.`Sales Class`, Sum(`Ahr1002-AUS`.`Outstanding Amount`) AS `SumOfOutstanding Amount`, Max(`Ahr1002-AUS`.`Customer Code`) AS `MaxOfCustomer Code`, Max(`Ahr1002-AUS`.`Customer Name`) AS `MaxOfCustomer Name`, Max(`Ahr1002-AUS`.`Order Date`) AS `MaxOfOrder Date`, Min(`Ahr1002-AUS`.`Promised Date`) AS `MinOfPromised Date`, Max(`Ahr1002-AUS`.`Desp Warehouse`) AS `MaxOfDesp Warehouse`, Max(`Ahr1002-AUS`.`Sell Warehouse`) AS `MaxOfSell Warehouse`, Max(`Ahr1002-AUS`.Product) AS MaxOfProduct, Max(`Ahr1002-AUS`.Description) AS MaxOfDescription, Max(`Ahr1002-AUS`.`Purchase Order`) AS `MaxOfPurchase Order`, Sum(`Ahr1002-AUS`.`Order Quantity`) AS `SumOfOrder Quantity`, Sum(`Ahr1002-AUS`.`Shipped Quantity`) AS `SumOfShipped Quantity`, Sum(`Ahr1002-AUS`.`Outstanding Quantity`) AS `SumOfOutstanding Quantity`, Max(`Ahr1002-AUS`.`Product Group`) AS `MaxOfProduct Group`, Max(`Ahr1002-AUS`.`Sales Class Description`) AS `MaxOfSales Class Description`, Max(`Ahr1002-AUS`.Status) AS MaxOfStatus, Sum(`Ahr1002-AUS`.`Unit Cost`) AS `SumOfUnit Cost`, Sum(`Ahr1002-AUS`.`Outstanding Cost`) AS `SumOfOutstanding Cost`, Max(`Ahr1002-AUS`.Currency) AS MaxOfCurrency, Max(`Ahr1002-AUS`.`Exchange Rate`) AS `MaxOfExchange Rate`
    FROM `ahr1002-AUS.txt` `ahr1002-AUS`
    GROUP BY `Ahr1002-AUS`.`Order Sales Rep`, `Ahr1002-AUS`.`Sales Order`, `Ahr1002-AUS`.`Delivery Date`, `Ahr1002-AUS`.`Line Status`, `Ahr1002-AUS`.`Sales Class`
    HAVING (((Left(`Sales Class`,4))=`SE05`)) OR (((Max(Left(`Order Sales Rep`,2)))>`68` And (Max(Left(`Order Sales Rep`,2)))<`90`));
    Any ideas?
    Last edited by treva26; 06-12-2013 at 02:42 AM.

  2. #2
    Forum Contributor
    Join Date
    06-12-2007
    Posts
    144

    Re: Getting data using MS Query

    Seems like its the HAVING criteria that are the problem.
    I have seen things with question marks where it asks you for the criteria, but I really just want it hard coded.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1