Results 1 to 6 of 6
  1. #1
    smeghead67 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    31

    Query has data, Report shows zeros

    Hello,



    I created an inventory control DB for my work. To show each item and a total, I have a query that gets the total of each part for each storage area and a total of that part. it also takes the valuation of each part and gives me a $ total. When i run this query, I get the current totals.
    Code:
    MFR     PN              Part                 Total   Lodge   Dungeon   Barn    Price each  Total Value
    IGT     500123        reel widget              5      2         1        1       $ .75        $3.75
    When i create a report using the report button on the create menu, it gives me all the fields from the report, but the totals are 0. it displays the item id number, name and price for one unit correctly, but the total columns for the storage areas and total of all parts and the $ total are zeros.

    Code:
    MFR     PN              Part                 Total   Lodge   Dungeon   Barn    Price each  Total Value
    IGT     500123        reel widget              0      0         0         0       $ .75        $0.00
    Am I missing something?

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    In your report, in design view, right click on the fields that have the incorrect data. Select Properties. Check the record source for each of the items and make sure that it is the query.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Actually, think need to click on the textboxes and look at ControlSource property. Very odd.

    Show the sql statement of the report RecordSource. Is it an aggregate (GROUP BY) query?
    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.

  4. #4
    smeghead67 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    31
    the report gets its info from the query invadmin
    Code:
    SELECT partqty.mfr, partqty.pn, partqty.description, partqty.purchasetype, partqty.total, partqty.Lodge, partqty.Track, partqty.Inventory, partqty.Mezz, partqty.Clubhouse, partqty.AppleBarn, partqty.WarehouseNorth, partqty.Bench, partqty.OutRepair, partqty.valueper, IIf([purchasetype]=2,0,(((([Lodge]+[Track]+[Inventory]+[Mezz]+[Clubhouse]+[AppleBarn]+[WarehouseNorth])*[valueper]))+(([Bench]+[OutRepair])*([valueper]*0.3333333333)))*[unitsize]) AS valuetotal, partqty.accounttype
    FROM partqty
    WHERE (((partqty.administrative)=Yes))
    ORDER BY partqty.mfr;
    now the partqty query uses subquerys is this the source of the problem with the report?

    partqty
    Code:
    SELECT Parts.pn, Parts.description, Parts.valueper, Parts.unitsize, Parts.reorder, Parts.repairable, Parts.purchasetype, Parts.iscritical, Parts.administrative, Parts.ledger, Parts.mfr, Parts.parttype, (SELECT SUM([part2].[qty])
        FROM partstore AS part2 
        WHERE (((part2.pid)=Parts.ID))) AS Tot, (SELECT SUM([part2].[qty])
        FROM partstore AS part2 
        WHERE (((part2.pid)=Parts.ID)) AND ((part2.binid) Like "L*")) AS Ldge, (SELECT SUM([part2].[qty])
        FROM partstore AS part2 
        WHERE (((part2.pid)=Parts.ID)) AND ((part2.binid) Like "B*")) AS Bnch, (SELECT SUM([part2].[qty])
        FROM partstore AS part2 
        WHERE (((part2.pid)=Parts.ID)) AND ((part2.binid) Like "T*")) AS Trk, (SELECT SUM([part2].[qty])
        FROM partstore AS part2 
        WHERE (((part2.pid)=Parts.ID)) AND ((part2.binid) Like "I*")) AS Inv, (SELECT SUM([part2].[qty])
        FROM partstore AS part2 
        WHERE (((part2.pid)=Parts.ID)) AND ((part2.binid) Like "A*")) AS AB, (SELECT SUM([part2].[qty])
        FROM partstore AS part2 
        WHERE (((part2.pid)=Parts.ID)) AND ((part2.binid) Like "M*")) AS Mzz, (SELECT SUM([part2].[qty])
        FROM partstore AS part2 
        WHERE (((part2.pid)=Parts.ID)) AND ((part2.binid) Like "C*")) AS Club, (SELECT SUM([part2].[qty])
        FROM partstore AS part2 
        WHERE (((part2.pid)=Parts.ID)) AND ((part2.binid) Like "N*")) AS WN, (SELECT SUM([part2].[qty])
        FROM partstore AS part2 
        WHERE (((part2.pid)=Parts.ID)) AND ((part2.binid) Like "O*")) AS OFR, IIf(IsNull([Tot]),0,[Tot]) AS Total, IIf(IsNull([Ldge]),0,[Ldge]) AS Lodge, IIf(IsNull([Bnch]),0,[Bnch]) AS Bench, IIf(IsNull([Trk]),0,[Trk]) AS Track, IIf(IsNull([Inv]),0,[Inv]) AS Inventory, IIf(IsNull([AB]),0,[AB]) AS AppleBarn, IIf(IsNull([Mzz]),0,[Mzz]) AS Mezz, IIf(IsNull([Club]),0,[Club]) AS Clubhouse, IIf(IsNull([WN]),0,[WN]) AS WarehouseNorth, IIf(IsNull([OFR]),0,[OFR]) AS OutRepair, Parts.ID, Parts.accounttype
    FROM Parts;
    Ted

  5. #5
    smeghead67 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    31
    Alansidman and June,

    the record source is the correct query.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I've never built query with subqueries to return single value but all looks like should work.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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. Report that shows Query dependencies
    By ChuckColeman1812 in forum Access
    Replies: 3
    Last Post: 01-08-2012, 12:15 PM
  2. Replies: 1
    Last Post: 07-15-2011, 10:59 PM
  3. My data is being cleared with zeros...
    By Kipster1203 in forum Access
    Replies: 5
    Last Post: 07-26-2010, 10:06 AM
  4. Report based on query shows no data
    By hbograd in forum Reports
    Replies: 2
    Last Post: 12-18-2009, 12:28 PM
  5. leading 'Zeros' in data
    By wasim_sono in forum Forms
    Replies: 3
    Last Post: 04-06-2009, 11:57 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