Access previous record control in current report.

dudezzz

Registered User.
Local time
Today, 14:51
Joined
Feb 17, 2005
Messages
66
How to transfer control value backward?

I have a report with a control that is a calculated field. Lets call this field "b"

I want to use the value of "b" in the next record for another control. Lets call this field "c"

I want to assign c = b

(Note that there are about 10 calculations done on the first report and finally the value of "b" is calculated. When the user clicks on the Next record navigator button on the bottom, this value of "b" needs to be copied over to another control called "c")

I do not know how to do this. Can anyone help me please?
 
Last edited:
Is this a continuous report or how is it formatted?

What should "c" equal in the very first record seeing as there is no previous record to get the "b" value from?

I'm thinking you could possibly use a public variable to hold the value while the record changes, but would need more information first.
 
Database attached

Richo,

Please find my db attached.

The field "grandtotalperunit" is on the report footer (bottom right corner) for the report "rptstep". This is a calculated field as you would see.

On the first record, this value is 526.89 I want to transfer this value to the next record (2nd record) for Cost/Unit across "hexapeptide".

You had helped me out in a similar situation to get previous record value in the report. Unfortunately, I am not able to apply that logic in this situation.

Any help you could provide will be greatly appreciated. Thanks!
 
Last edited:
In record 2 there is more than one detail under Bill Of Materials. Is is always the first detail that gets the value from the previous record transferred over?

Can there be more than 2 records in this report where the calculation in the footer on record 2 needs to be transferred to the first detail in record 3?
 
In record 2 there is more than one detail under Bill Of Materials. Is is always the first detail that gets the value from the previous record transferred over?

Can there be more than 2 records in this report where the calculation in the footer on record 2 needs to be transferred to the first detail in record 3?


Here are the answers to your question:

We can safely assume that always the first detail on Record x gets the value from the previous record (Record x-1).

Yes. I am trying to see how this works in a 2 Record situation (footer value of record 1 transferred to the first detail on Record 2). However, this logic need to be iterative to x records. If it is the first record there is no detail that needs to be transferred over. (All info is typed in by the user on the first record stored in the table)

Thanks for your time on this Richo.
 
This is what I came up with....

On the report footer I stored the calculated value into a public variable (defined in Module1).

I had to put an invisible unbound text box in the subform to hold the value from the public variable because it wouldn't allow me to assign a value to the cpu textbox. The control source for the "cpu" textbox is now an IIf which checks if there is a value in the unbound textbox and displays it instead of cpu if so.

This seems to work for what you have in the report so far, who knows what will happen as the report grows.

Good luck.
 

Attachments

Thank you.

Richo - Thanks for helping me out. This is very helpful.
 
How to transfer value backward in a Report?

Sometime back "Richo" helped me out on this thread and taught me how to move a value from a report footer control from the 1st record to the 2nd record and so on ..... Thanks to Richo! This solution worked wonders for me!

Now, on the same report I need to perform a calculation backwards. Let me explain:

Lets say I have a report consisting of 3 records. I need to transfer the value of a control from the 3rd record to the 2nd record....I need to do the same from the 2nd record to the 1st one.

Has anyone encountered a situation like this before? I was thinking of storing the calculated values in a table and using them in the report for this.

Being an Access novice, I am not able to think of any good method to achieve this. If anyone has a suggestion, please let me know. Many thanks.
 
More details in here on my question.

Please find attached a Word document that explains what exactly I am trying to do along with my test database attached. I am lacking reasonable coding experience in Access that prevents me from getting this done. Would appreciate if any gurus in this forum could help.

Many Thanks!
 

Attachments

Last edited:

Users who are viewing this thread

Back
Top Bottom