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

cloudsurfer

New member
Local time
Today, 12:45
Joined
Mar 23, 2020
Messages
12
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:45
Joined
Sep 21, 2011
Messages
5,961
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:45
Joined
Mar 3, 2013
Messages
38
Use the dirty way, fill a variable in the report_Close. Declare the variable in a module!
 

theDBguy

I’m here to help
Local time
Today, 04:45
Joined
Oct 29, 2018
Messages
10,705
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:45
Joined
Mar 3, 2013
Messages
38
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, 12:45
Joined
Mar 23, 2020
Messages
12
: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, 12:45
Joined
Mar 23, 2020
Messages
12
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:45
Joined
Mar 3, 2013
Messages
38
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
Local time
Today, 04:45
Joined
Oct 29, 2018
Messages
10,705
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, 12:45
Joined
Mar 23, 2020
Messages
12
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:45
Joined
May 23, 2011
Messages
3,836
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, 12:45
Joined
Mar 23, 2020
Messages
12
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:45
Joined
May 23, 2011
Messages
3,836
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

error reading drive A:
Local time
Today, 19:45
Joined
May 7, 2009
Messages
9,580
bring youir Report to design view.
select the Total textbox.
on its Property->Format->No Duplicate=Yes.
 

cloudsurfer

New member
Local time
Today, 12:45
Joined
Mar 23, 2020
Messages
12
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, 07:45
Joined
Feb 19, 2002
Messages
28,998
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 (Users: 0, Guests: 1)

Top Bottom