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
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
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.
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
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.
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.