Solved Change Recordsource for a Sub.Report

Ksabai

Registered User.
Local time
Yesterday, 20:46
Joined
Jul 31, 2017
Messages
104
i have 3 subforms in a form, want to change the recordsource for all the 3 forms if to be displayed in this form. iam using the following:

If TempVars!sRepRecSrc01 <> vbNullString Then Me.Pro_FormaDue.Report.RecordSource = TempVars!sRepRecSrc01

Error is You Entered and Expression That Has an Invalid Reference to the Property Form/Report

Someone Kindly help
 
Where exactly did you put this code? On the main form or the subform, and which event?
 
sorry Typo Error
i have 3 subReports in a Report, want to change the recordsource for all the 3 subreports if to be displayed in this report. iam using the following:

If TempVars!sRepRecSrc01 <> vbNullString Then Me.Pro_FormaDue.Report.RecordSource = TempVars!sRepRecSrc01

Error is You Entered and Expression That Has an Invalid Reference to the Property Form/Report

Someone Kindly help
 
iam entering in the open event of the Main Report
 
iam entering in the open event of the Main Report
Hi. When you refer to a subreport to change its record source, you'll have to make sure you're using the name of the control - not the name of the report it contains.
 
If TempVars!sRepRecSrc01 <> vbNullString Then [Reports]![rptFullDue]![Pro-FormaDue].Report.RecordSource = TempVars!sRepRecSrc01

The Above also Doesn't Seem to Work
 
If TempVars!sRepRecSrc01 <> vbNullString Then [Reports]![rptFullDue]![Pro-FormaDue].Report.RecordSource = TempVars!sRepRecSrc01

The Above also Doesn't Seem to Work
Did you verify the name of your subreport control?
 
Yes it is correct
Okay. What does "doesn't work" mean? Are you getting any errors? If so, what was the error message? Are you able to post a demo version of your db showing the problem?
 
let me try tomorrow, will let u know.
 
I used the below line in the Open Event of the Sub-Report and it working fine now.
If TempVars!sRepRecSrc01 <> vbNullString Then Me.RecordSource = TempVars!sRepRecSrc01

But now i get the error "you can't set the source property in print preview or after printing has started access" for about 4 times. i have 3 subreports. How to resolve this error
 
I used the below line in the Open Event of the Sub-Report and it working fine now.
If TempVars!sRepRecSrc01 <> vbNullString Then Me.RecordSource = TempVars!sRepRecSrc01

But now i get the error "you can't set the source property in print preview or after printing has started access" for about 4 times. i have 3 subreports. How to resolve this error
It's a balancing act, isn't it. I'll wait for your sample file to take a look.
 
iam getting the error 2455, i don't know how to do this
 
there is No way you can change the Recordsource of a Report other than it's Open Event.
likewise there is no way you can set it's Recordset property.

you change the recordsource on to Open event of Each subReport.
additionally you can try:

If IsNull(TempVars("sRepRecSrc01"))=False Then …
 
Last edited:

Users who are viewing this thread

Back
Top Bottom