Page 2 of 2 FirstFirst 12
Results 16 to 29 of 29
  1. #16
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Given your samples, you're tracking some raw gasses that are primarily a mix of propane and butane.



    Let me verify your business rules before we proceed.

    Answer each question below, please.
    1) Will the readings be taken at the same time each day, (8 AM etc) or can they change (10:55AM) ?

    If they can change, do the headings need to show the exact time, or should they be rounded to display the hour?

    2) Do you want the database to store notes for each time that readings may be taken?

    3) Will there always be readings of both kinds Mole and SPG at each time readings will be taken?

    4) How is sulphur entered into the database? what units?

    5) What are the possible values for copper corrosion? Where and how is it being entered? Is 1a supposed to mean 1 micron, or is it shorthand for some particular kind of footnote?

    6) Post 15 is not the same report layout that you entered into post #1.
    A) Does the layout in Post #1 expect to have 40 individual columns that are averaged in column 41?
    B) Or is each day in the layout in Post #1 an average of the four daily reads that would show up on a the layout in post #15?

  2. #17
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Thanks to respond
    Regarding point # 1 / / / / time varies according to employee screening go to the site
    Regarding point # 2 / / / Yes
    Regarding point No. 3 / / / Yes
    Regarding point No. 4 / / / units are sulfur (number or word null
    Regarding point No. 5 / / / as well as the number or the word null
    Regarding point # 1 / / / Yes, I just want an example of that, and I thank you that it works very well now
    Shows the average
    No, not necessary 40
    But the problem is in the form of the report is the first report shows how horizontally?

  3. #18
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    1) Change your tables to the following:
    Code:
    tblReadings
       ReadID     Autokey
       ReadDate   Date/Time 
       ReadTime   Date/Time 
       ReadNotes  Memo
    
    tblMole
       MoleID     AutoKey
       ReadID     Number (FK to tblData)
       C2         Currency (Format Standard, 2 decimals)
       C3         Currency (Format Standard, 2 decimals)
       C4         Currency (Format Standard, 2 decimals)
       C5         Currency (Format Standard, 2 decimals)
       C6         Currency (Format Standard, 2 decimals)
    
    tblSPG
       SPGID      AutoKey
       ReadID     Number (FK to tblData)
       SPGR       Currency (Format Standard, 2 decimals)
       RVP        Currency (Format Standard, 2 decimals)
       Corrosion  Currency (Format Standard, 2 decimals)
       TestC      Currency (Format Standard, 2 decimals)
       Sulphur    Currency (Format Standard, 2 decimals)
    Create two tables Like this:
    Code:
    tblCrossAvg
       RecID          Number
       RecType        Text
    
    tblCrossComp
       CompNumber     Number   
       Composition    Text
    Add these records to the tables
    Code:
    tblCrossAvg
      RecID      RecType
        1        Detail
        2        Average
    tblCrossComp
     CompNumber  Composition
        1        C2%(Mole) 
        2        C3%(Mole) 
        3        C4%(Mole) 
        4        C5%(Mole) 
        5        C6%(Mole) 
        6        Total
        7        SPGR
        8        RVP         
        9        CU Corrosion
       10        TestC
       11        Sulphur
    Create and test a Query Like this:
    Code:
    qryReads:
       SELECT 
          T0.ReadID,       
          T0.ReadDate, 
          T0.ReadTime, 
          T1.C2, 
          T1.C3, 
          T1.C4, 
          T1.C5, 
          T1.C6, 
          (T1.C2+T1.C3+T1.C4+T1.C5+T1.C6) AS CTotal
       FROM 
          tblReadings AS T0
          INNER JOIN 
          tblMole AS T1
          ON T0.ReadID = T1.ReadID
       WHERE T0.ReadDate Between #10/11/2013# And 29/11/2013#;
    The purpose of that query is to get all the required data on one record. The hard-coded starting and ending dates can be replaced later with tempVars or references to controls on a form, after testing is complete.

    This next query will take those records and sort the data fields from that query into simple records that contain only three fields - the value for the row ("Composition" - C2, C3 etc) , the value for the column ("ReadPoint" - date or average), and the value that goes in that intersection ("TheValue").
    Code:
    qryReadsH:
    SELECT 
       TC.Composition AS Composition, 
       Switch(TA.RecID=1, Format(QR.ReadDate,"DD/MM ") & Format(QR.ReadTime,"HH:NNAM/PM"), 
              TA.RecID=2, "Average") AS ReadPoint, 
       Switch(TC.CompNumber=1,QR.C2,
              TC.CompNumber=2,QR.C3,
              TC.CompNumber=3,QR.C4,
              TC.CompNumber=4,QR.C5,
              TC.CompNumber=5,QR.C6,
              TC.CompNumber=6,QR.CTotal
             ) AS TheValue
    FROM tblCrossAvg AS TA, tblCrossComp AS TC, qryReads AS QR
    WHERE TC.CompNumber Between 1 and 6
    AND TA.RecID Between 1 and 2;
    Now this query will get you the top half of your report:
    Code:
    qryCrossAvgH:
    TRANSFORM Avg(QH.TheValue) As Stuff
    SELECT QH.Composition
    FROM qryReadsH AS QH
    GROUP BY QH.Composition
    PIVOT QH.ReadPoint;
    If you wanted to average by day instead of showing each read, you would change the first line of qryReadsH to remove the time and just have each column by date. You could do another one averaged by week or month if you wanted. Here's the version by Day:
    Code:
    qryReadsD:
    SELECT 
       Switch(TA.RecID=1, Format(QC.ReadDate,"DD/MM"), 
              TA.RecID=2, "Average") AS ReadPoint, 
       TC.Composition AS Composition, 
       Switch(TC.CompNumber=1,QR.C2,
              TC.CompNumber=2,QR.C3,
              TC.CompNumber=3,QR.C4,
              TC.CompNumber=4,QR.C5,
              TC.CompNumber=5,QR.C6,
              TC.CompNumber=6,QR.CTotal
             ) AS TheValue
    FROM tblCrossAvg AS TA, tblCrossComp AS TC, qryReads AS QR
    WHERE TC.CompNumber Between 1 and 6
    AND TA.RecID Between 1 and 2;
    
    qryCrossAvgD:
    TRANSFORM Avg(QD.TheValue) As Stuff
    SELECT QD.Composition
    FROM qryReadsD AS QD
    GROUP BY QD.Composition
    PIVOT QD.ReadPoint;
    When you've verified and tested that in your database, then you can use the same method to create a DIFFERENT query for the bottom half. I emphasize "different", because the data is coming from a different table, and while you could union them together to get your report, or join them together with a double-left-join, it's better practice to just make two different subreports that appear on the same report.

    Notes - Do not enter the text word Null - it will give you the mother of all headaches. Just leave the data Null/blank/zero. If there is no difference between zero and null, then entering zero would be preferable.

  4. #19
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Thank you very much Dal Jeanis
    On the good work
    Attached Files Attached Files
    • File Type: zip G.zip (42.1 KB, 3 views)
    Last edited by azhar2006; 11-28-2013 at 06:32 AM.

  5. #20
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Attachment 14553Show me this message

  6. #21
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Thank you very much
    You are the creator
    But I am having a problem /// Between #10/10/2013# And #12/29/2013#

    Can I control history
    Or the author of a text box on the form number 2
    Through the text box and enter the date of the beginning of the end of history
    To view the report
    I tried to put
    Between [Enter Start Date] And [Enter End Date]
    But it seems to me an error message

  7. #22
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Okay,
    1) In qryreadsD, QC.ReadDate should be QR.ReadDate.
    2) Edit the Table Relationships,
    A) Remove both the relationships that are there now, (right-click on hte line and delete them)
    B) Add tblreadings to the diagram
    C) Set a one-to-one relationship between tblReadings and tblSPG on ReadID,
    D) Set a one-to-one relationship between tblReadings and tblMole on ReadID.
    E) Save the relationshp diagram.

    3) To test, you need data in the tables - (tblReadings, tblMole, tblSPG)

    A) Add several readings to tblreading first.
    B) Then add sample data for tblMole for each reading. You can just copy one record and change a couple of values.

    4) Now TEST.

  8. #23
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Thank you very much Dal Jeanis
    I tried but I can not
    This database is full
    Attached Files Attached Files

  9. #24
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    The reports look fine. The test data is bad -- it looks like you entered it into the table sideways, where the values for each c% went into a different record -- but the reports appear to be working great.

  10. #25
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Yes, the problem is
    At the beginning of history
    The end of history
    So I see in the report, for example, And so on to the end of the year
    From 11/10/2013 to 11/20/2013Click image for larger version. 

Name:	1458951_654776571239202_1607682014_n.jpg 
Views:	16 
Size:	157.8 KB 
ID:	14669

  11. #26
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Thank you very much Dal Jeanis
    In fact you are the king of Access

    I want, for example, each sheet of A4 ten readings or read 15
    In the sense that one month is printed 2 or 3 pages

  12. #27
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972
    The report in database file shows days crossing over months. If you want to allow multiple months/years on same report and have the columns in date order, the date value in the queries should be formatted as YYYY/MM/DD.

    I presume you are using international date arrangement for entering date values. You might review http://allenbrowne.com/ser-36.html
    And this recent thread on the topic https://www.accessforums.net/program...ite-39719.html

    The queries have so many levels and with the aliases it is hard to trace the construction. I don't use aliases in simple queries, only if there are nested subqueries. I know the aliases allow for shortened names in sql statements but then have to switch to SQL View to figure out the query genealogy.
    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.

  13. #28
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Hello again
    I have suffered from the design of the final report
    Please help me is how to be in the final report
    Only the arithmetic average of one day without clocks
    The report also will be for a period of 10 days only

  14. #29
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528
    [QUOTE=azhar2006;200246]Hello all

    Is it possible to work this report?
    I enclosed a picture of the report

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query Design Problem
    By hardleydirt in forum Queries
    Replies: 5
    Last Post: 11-16-2012, 01:58 PM
  2. design problem
    By masoud_sedighy in forum Database Design
    Replies: 1
    Last Post: 12-15-2011, 11:22 AM
  3. complex design problem
    By Madmax in forum Access
    Replies: 2
    Last Post: 12-09-2011, 08:25 AM
  4. design problem
    By marianne in forum Database Design
    Replies: 7
    Last Post: 05-26-2009, 07:25 PM
  5. Forms design problem
    By GeorgeD in forum Forms
    Replies: 2
    Last Post: 05-08-2008, 12:28 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