Results 1 to 10 of 10
  1. #1
    reidn is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jun 2011
    Posts
    37

    loop and query structure

    Hello All,



    I have a Form where one selects a range of dates to pull information from a table. I need to display a score for each day in the range selected. The score is calculated by dividing the total nonconformant by the total inspected.

    So I have a query (based on period selected) that fills a listbox with Julian date, Actual Date, Quantity Inspected, and Quantity Nonconformant from the table. From this list box I need to group all the info for one julian day and determine the score from it, repeating until the entire date range has been covered and all information displayed. I am completely stumped as to how to move from here...

    Thank you for all of your help and if this doesnt make sense I can go into more detail,

    Reid

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Why are you trying this in a form? Sounds like something that should be done in a filtered report using Grouping & Sorting with summary calcs.
    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.

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    so you are entering two different dates and you want to see one line per day within that range displayed in a list box? Do you intend to do anything with the items in the list box (like select one and do something with it?) If you intend to use the data in the list box for anything but a visual aid a list box is not necessarily your best option. Also can you give an example of what your data looks like in your table and how you want the end result to look within your list box.

  4. #4
    reidn is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jun 2011
    Posts
    37
    June, I am new to access so I have no idea what you are talking about but I will look into it.

    Rpeare, yes and for each day I need the score to be calculated and displayed (There are about 100-200 records per day). Also the information will likely be placed in an excell sheet later. The Table I am drawing data from looks like...

    Date: Quantity N/C: Quantity Insp: Inspector:
    1/8/11 0 6 Bobert
    1/8/11 3 3 Laquisha
    1/9/11 3 6 Ahkmed
    1/9/11 0 6 Cletus
    1/9/11 0 6 Frank

    And so on... Is that what you were asking?

    The listbox, using above info, should look like...

    Date: Score:
    1/8/11 0.333
    1/9/11 0.166

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Here's a quick example, the list box is populated when you exit the end date field. I changed your table field names because you should try to stay away from using reserved words (Date, Name, Count, etc) and also stay away from special characters (/, #, $, %, etc) and spaces in your field names or object names in your database, they will only cause you problems as you become more involved in programming.

  6. #6
    reidn is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jun 2011
    Posts
    37
    rpeare,
    That is exactly what I was looking for. Thank you for helping me out so much!!

  7. #7
    reidn is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jun 2011
    Posts
    37
    rpeare,

    I tried to integrate it and it keeps telling me to enter parameter values for everything

  8. #8
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Then you're not correctly converting everything for your setup, that parameter pop up only comes up if you've got an unidentified item, this can be a misspelling of a field name, a table name, a query name, a control name (text box, list box, etc). Without seeing an example of your database it would be nearly impossible for me to tell you where to look.

  9. #9
    reidn is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jun 2011
    Posts
    37
    nevermind fixed it

  10. #10
    reidn is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jun 2011
    Posts
    37
    and what?? I thought yall were supposed to guess what they were... These forums arent what they used to be. I did enter something wrong (resulted from a / character)

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

Similar Threads

  1. BD Structure (review)
    By Bryan021 in forum Database Design
    Replies: 0
    Last Post: 05-26-2011, 11:39 AM
  2. New Guy Structure questions
    By cgjames in forum Database Design
    Replies: 11
    Last Post: 01-19-2011, 07:16 AM
  3. Table Structure
    By megabrown in forum Database Design
    Replies: 1
    Last Post: 11-18-2010, 04:12 AM
  4. Help with Database Structure
    By scottay in forum Access
    Replies: 8
    Last Post: 06-30-2010, 08:16 AM
  5. Loop a table to use field in query
    By jdubp in forum Programming
    Replies: 0
    Last Post: 03-04-2008, 11:48 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