Use textbox value of 1 report to autofill a textbox in another report (1 Viewer)

cloudsurfer

New member
Local time
Today, 13:27
Joined
Mar 23, 2020
Messages
18
Hi all,
This must be very simple but I'm stuck for hours, googling, trying etc.
Simplistic version.
Report 1 has a list of values and at the bottom a sum of these values in a textbox (lets call it total).
Report 2 has a textbox and in this textbox, the value of total.
I've tried in properties =[Rapporten]![Total Night]![Tekst7].[Text] but this ends up with an error.
With a bit of VB knowledge I would expect I could select .[value] but in properties I can't.
Hopefully it's doable with a simple line of text instead of coding but if that's the case, that's an option too.
 

Gasman

Enthusiastic Amateur
Local time
Today, 12:27
Joined
Sep 21, 2011
Messages
14,038
I do not think you can reference the Text property unless that control has the focus.? Trying to show that in a report gives that error?
Also I thought that held the old value.? Why not just use the control or the control.Value ?
 

Rene vK

Member
Local time
Today, 13:27
Joined
Mar 3, 2013
Messages
123
Use the dirty way, fill a variable in the report_Close. Declare the variable in a module!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 05:27
Joined
Oct 29, 2018
Messages
21,357
Hi Chris. Welcome to AWF!

Couldn't you calculate the same total value using an expression? Just curious...
 

Rene vK

Member
Local time
Today, 13:27
Joined
Mar 3, 2013
Messages
123
Hi Chris. Welcome to AWF!

Couldn't you calculate the same total value using an expression? Just curious...
Your sum is calculated with figures from your table. Create the expression in the textbox on Report2
 

cloudsurfer

New member
Local time
Today, 13:27
Joined
Mar 23, 2020
Messages
18
:unsure: that could be the easy answer I was looking for.
This is the query:
SELECT totaaltabel.Nighttime, totaaltabel.Type
FROM totaaltabel
WHERE (((totaaltabel.Nighttime)>0));
And then I use the query to form the report with at the bottom a text with the total using =sum(nighttime).
How will that fit in 1 expression?
 

cloudsurfer

New member
Local time
Today, 13:27
Joined
Mar 23, 2020
Messages
18
Solved it. Forgot to setup the main Table as the source. Now the expression works.
And since that table is the main source, I should be able to get all different totals out from it with sum if.
thx !!
 

Rene vK

Member
Local time
Today, 13:27
Joined
Mar 3, 2013
Messages
123
Solved it. Forgot to setup the main Table as the source. Now the expression works.
And since that table is the main source, I should be able to get all different totals out from it with sum if.
thx !!
Welcome!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 05:27
Joined
Oct 29, 2018
Messages
21,357
Solved it. Forgot to setup the main Table as the source. Now the expression works.
And since that table is the main source, I should be able to get all different totals out from it with sum if.
thx !!
Congratulations! Glad to hear you got it sorted out. Good luck with your project.
 

cloudsurfer

New member
Local time
Today, 13:27
Joined
Mar 23, 2020
Messages
18
Sadly it's not working yet.
I do get my sum but for some reason it repeats itself many times.
I've readup on it and it's not the width of the page.
Report record source = mytable
Then in the detail section on the text box I've put =Sum([Nighttime])
But it repeats about 1968 times.
Any idea?
btw: I'm just testing, 2nd box should be empty so that's not the problem
 
Last edited:

bob fitz

AWF VIP
Local time
Today, 12:27
Joined
May 23, 2011
Messages
4,717
Sadly it's not working yet.
I do get my sum but for some reason it repeats itself many times.
I've readup on it and it's not the width of the page.
Report record source = mytable
Then in the detail section on the text box I've put =Sum([Nighttime])
But it repeats about 1968 times.
Any idea?
btw: I'm just testing, 2nd box should be empty so that's not the problem
View attachment 83091
Perhaps need to set the form as single. Not continuous
 

cloudsurfer

New member
Local time
Today, 13:27
Joined
Mar 23, 2020
Messages
18
I don't have that option in my report.
I can choose "reportview" or "print preview" in the default view section
 

bob fitz

AWF VIP
Local time
Today, 12:27
Joined
May 23, 2011
Messages
4,717
I don't have that option in my report.
I can choose "reportview" or "print preview" in the default view section
My apologies. I mistook the screen shot you posted of your report as a form😱.
I can't help you further at this stage.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 20:27
Joined
May 7, 2009
Messages
19,169
bring youir Report to design view.
select the Total textbox.
on its Property->Format->No Duplicate=Yes.
 

cloudsurfer

New member
Local time
Today, 13:27
Joined
Mar 23, 2020
Messages
18
That helped 50% thx.
Now the info is not duplicated but the report still produces 1968 empty reports...?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 08:27
Joined
Feb 19, 2002
Messages
42,970
Reports don't hold data, tables hold data. if you want to calculate values in a report, you need to base your calculations on a table or a query. If the source of the data is not in the report's RecordSource itself, you will need to use domain functions or possibly subreports to pull in the additional data.
 

Users who are viewing this thread

Top Bottom