Results 1 to 5 of 5
  1. #1
    cfobare79 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Dec 2014
    Posts
    66

    Query Results error

    I have the SQL for my query below. I'm pulling from multiple tables. The query works great until I added the VerizonTable. Once the VerizonTable is added I recieve no results from the query. I have ensured that all the Field Names and Field Types are the same between DaveWelchTable and VerizonTable. I receive an error message stating that there are multiple Quantities to draw from. Please please with code. Thank you.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    Then there is a problem with the query. Try using single link to Verizon only, check the results.
    Then work outward. Add tables. It may be too many tables causes unexpected results.

    I would build a union query that contains all other parties as a single query, THEN join to other tables.
    (it seems a design flaw. you would not have separate tables for separate companies. They would all be in 1 table tCompanyData , with a field to determine which company it belongs to.)

  3. #3
    cfobare79 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Dec 2014
    Posts
    66
    SELECT AgencyList.AgencyID, AgencyList.AgencyName, AgencyList.Address, AgencyList.ZipCode, ZipCodeT.City, ZipCodeT.State, RateTable.Rate, RateTable.Unit, DaveWelchTable.Quantity, DaveWelchTable.BillingPeriod, RateTable.ServiceName, ServiceGroupT.ServiceGroup, AgencyList.WPSBillingType, IIf(IsNull([Quantity]),0,[Quantity]*[Rate]) AS Totals, VerizonTable.Usage
    FROM ZipCodeT INNER JOIN ((ServiceGroupT INNER JOIN (RateTable INNER JOIN (AgencyList INNER JOIN DaveWelchTable ON AgencyList.AgencyID = DaveWelchTable.AgencyID) ON RateTable.ServiceID = DaveWelchTable.ServiceID) ON ServiceGroupT.ServiceGroup = RateTable.ServiceGroup) INNER JOIN VerizonTable ON (RateTable.ServiceID = VerizonTable.ServiceID) AND (AgencyList.AgencyID = VerizonTable.AgencyID)) ON ZipCodeT.ZipCode = AgencyList.ZipCode
    GROUP BY AgencyList.AgencyID, AgencyList.AgencyName, AgencyList.Address, AgencyList.ZipCode, ZipCodeT.City, ZipCodeT.State, RateTable.Rate, RateTable.Unit, DaveWelchTable.Quantity, DaveWelchTable.BillingPeriod, RateTable.ServiceName, ServiceGroupT.ServiceGroup, AgencyList.WPSBillingType, IIf(IsNull([Quantity]),0,[Quantity]*[Rate]), VerizonTable.Usage
    HAVING (((AgencyList.AgencyID)=[Forms]![Filter]![Combo4]) AND ((DaveWelchTable.BillingPeriod)>=[Forms]![Filter]![Combo0] And (DaveWelchTable.BillingPeriod)<=[Forms]![Filter]![Combo2]) AND ((ServiceGroupT.ServiceGroup)=[Forms]![Filter]![Combo13]));

  4. #4
    cfobare79 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Dec 2014
    Posts
    66
    The tables have to be set the way they are because of the importation of data and the structure.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,643
    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.

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

Similar Threads

  1. Replies: 5
    Last Post: 05-21-2013, 02:21 PM
  2. Replies: 3
    Last Post: 05-02-2013, 10:36 AM
  3. Replies: 7
    Last Post: 09-21-2012, 03:30 PM
  4. Replies: 6
    Last Post: 05-14-2012, 07:24 AM
  5. Code results in error on the first day of every month
    By boomerang in forum Programming
    Replies: 6
    Last Post: 11-05-2011, 11:29 AM

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