Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2012
    Posts
    23

    Showing average value in a form

    Dear all,

    In my form I would like to show a number which is a result of two rows divided by each other.

    So my form consisist of

    1. Row 1 (data)
    2. Row 2 (data)

    3. Row 1/Row



    Does anyone know how i can create row 3?

    Dear regards, Marc

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,631
    Not easy. Here is one method for associating two records of same table http://allenbrowne.com/subquery-01.html#AnotherRecord
    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
    qa12dx is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    india
    Posts
    112
    how i do it is;
    - in the table if there isn't a autonumber field i make one
    - make a query (lets call it qry1)- select the table you need - auto_n:[autonumber field]-1, field that you need
    - make another query (lets call it qry2), take table and qry1. join on autonumber field and auto_n. select field from table and field from qry1.
    - now do what ever calcs you want

    quite simple eh? yes i'm a genius :0 lol

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    qa12dx,
    That will probably work if you move from autonumber to an assigned sequential number (Dmax +1 approach).
    The allen browne subquery approach and some vba is probably more robust. Have you tried your "genius solution/approach"?
    If so could you post your set up.

    An autonumber is NOT necessarily sequential, nor positive. M$oft says only that it is unique.

  5. #5
    qa12dx is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    india
    Posts
    112
    i use it a fair bit. since the data needs to be calculated per next row i assumed the persons data is already in sequence. adding autonum field should be sequential.

    but in the case it isn't, do a append query to a the table with no records, having sorted the data they way you need it.

    anyways, attached is small one i made, which reads event logs and basically sees when and if the power supply to a machine is interputed. i haven't finished it as i am working on some curcuit design, but its complete as far as showing what i'm talking about.

    like you said, just adding autonum doesn't always work, here i had to use date to sort. appending sorted results will always give you sequntial records in the order you sorted. another insteresting thing was after joining, since i needed to calc for record set/date (daywise), the next day was coming up, so i had to join on autonumber and date.

    don't worry about the linked file. i append the data to the table called _raw_table. i'm not going into details what i did here. i'm sure you can hack it. cheers.

    and Marc hope it was of some help. cheers man.
    Attached Files Attached Files

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

Similar Threads

  1. form min/max not showing
    By bigmac in forum Access
    Replies: 3
    Last Post: 03-06-2012, 05:56 AM
  2. Replies: 5
    Last Post: 10-27-2011, 10:25 AM
  3. Form not showing
    By piper in forum Forms
    Replies: 18
    Last Post: 04-15-2011, 12:44 PM
  4. Replies: 13
    Last Post: 05-28-2010, 11:57 AM
  5. Startup form not showing?
    By cfasoftware in forum Access
    Replies: 1
    Last Post: 01-21-2010, 03:10 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