Results 1 to 11 of 11
  1. #1
    chr1stoper1 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    57

    Number of Feilds in a query

    Hi Guys



    I have a question regarding the number of fields in a query. I have a query that is looking at production scrap by categories. There are fifteen categories of type of scrap and in addition to these I am using the query to work out the total % of total scrap for each category .My problem is there are not enough fields to do all the calculations .Is there a way of adding more or is there a better way of doing what im trying to achieve?

    Thanks in advance for any help

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    I think you are doing it wrong, you don't add fields, you add records.
    you need a tCata table.
    in it is 1 field,[cata] with all the various records a category can be.

    the table tScrap would have the master item, and table tScapCata is a child table of tScrap. (Lookup child records)
    this way 1 SCRAP item can have infinite categories.

    tScrap table
    [scrapID]
    [item name]
    [date]

    tScrapCata table
    [scrapID]
    [cata]

    this would allow you to count and calculate percents.

  3. #3
    chr1stoper1 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    57
    Quote Originally Posted by ranman256 View Post
    I think you are doing it wrong, you don't add fields, you add records.
    you need a tCata table.
    in it is 1 field,[cata] with all the various records a category can be.

    the table tScrap would have the master item, and table tScapCata is a child table of tScrap. (Lookup child records)
    this way 1 SCRAP item can have infinite categories.

    tScrap table
    [scrapID]
    [item name]
    [date]

    tScrapCata table
    [scrapID]
    [cata]

    this would allow you to count and calculate percents.
    Hi thanks for the reply. My table is populated with product name ,product number, the machine it was made in, amount produced, amount scrap then fifteen different reasons for scrapping and the number of that part that was scrapped that day for each of the fifteen reasons . This is how I receive the data each day. I have just been populating a table

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    There is a limit of 255 fields in table or query. Period.

    You might need a UNION query here to rearrange the data into a normalized structure. Then use that query as the source for subsequent queries to do the aggregate calcs.

    SELECT ID, ProductName, ProductNumber, MachineID, AmountProduced, AmountScrap, "R1" AS ReasonCode, Reason1 AS ReasonData, Part1 AS PartNo FROM Tablename
    UN ION SELECT ID, ProductName, ProductNumber, MachineID, AmountProduced, AmountScrap, "R2", Reason2, Part2 FROM Tablename
    ...;

    That essentially emulates a dataset that would result from a query joining 2 normalized tables as described by ranman.
    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.

  5. #5
    chr1stoper1 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    57
    In a query in design view can you have more than 27 different selections?

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Before deciding HOW to do your calculation, get your facts clearly stated. Focus on WHAT data/outputs are important. And then design the algorithms/calculations to get the correct outputs. Then adjust to get the format you need.

    Because you receive data in one format does not mean that is how it should be stored. Database tables are built on some underlying concepts (basically Normalization) that facilitates manipulation.

    Show us

    • some representative inputs you receive
    • a sample calculation
    • some sample output you need


    Good luck

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Limit of 50 SELECT lines in a UNION 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.

  8. #8
    chr1stoper1 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    57

    Scrap

    Hi guys
    the attached files show the main menu of my database all of which now work ok. Also there are two reports which populate my tables daily after ive added the dates and filled in the blanks on the detail numbers. The query is now my main problem. If I isolate one type of scrap (restart) for example/in the query I want to add an expression to work out the % of the scrap that was made up of restart. Then just return the top 10. I keep getting a overflow fault.
    Any ideas?
    Attached Thumbnails Attached Thumbnails PAGE.PNG   QUERY.PNG  
    Attached Files Attached Files

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    The only file in the zip is an Excel. What should be done with it?

    Recommend no spaces or special characters/punctuation (underscore is exception) in naming convention. Instead of %Short, use PctShort. But why are you dividing by 100 if you want to show percent?
    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.

  10. #10
    chr1stoper1 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    57
    Hi
    Thanks for the reply. The excel sheet is how I receive the scrap info for the previous day. I run a couple of macros to add date and fill in the gaps which are in the sheet if one machine makes a left and right part the machine number appears only once. I upload the whole finished sheet to a table and I have set up the database to analyse it in lots of ways. Everything works great but now I'm trying to ask the database "what is the worst 10 jobs by percentage of total scrap made for each different category" the way I work out percentage total amount of scrap by category divided by one percent of total scrap which is (total scrap divided by 100).
    It is just the way i've always done it.
    Would this have an impact on why I'm getting an overflow error?

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Probably. Access has limit on size of numbers it can deal with. Review http://answers.microsoft.com/en-us/o...f-15112836c77a
    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. Reports: Feilds vs Expressions
    By colleenvr in forum Reports
    Replies: 5
    Last Post: 08-13-2014, 10:35 PM
  2. Replies: 2
    Last Post: 03-04-2014, 06:46 AM
  3. Sum of Two Feilds of Two Queries in Seperate Query
    By shekar_genius in forum Queries
    Replies: 3
    Last Post: 03-13-2013, 08:27 AM
  4. Replies: 12
    Last Post: 12-14-2012, 06:25 PM
  5. Replies: 15
    Last Post: 08-30-2012, 04:16 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