473,473 Members | 1,824 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Error 2455

Why do I get this error when I run this code from a report's open event?

strSQL = "Select * from qsrptCaveat"
If Forms!fdlgPrint!chkInclude = False Then strSQL = strSQL & " Where
[Withdrawn] = 0"
Me.subCaveat.Report.RecordSource = strSQL

"subCaveat" is the object name (not the report name) of the sub-report on
the report. The error message is:

"You entered an expression that has an invalid reference to the property
Form/Report."

The report runs fine when I don't try to set its record source at runtime.

Many thanks.

Keith.

Nov 8 '07 #1
6 5832
Keith Wilby wrote:
Why do I get this error when I run this code from a report's open event?

strSQL = "Select * from qsrptCaveat"
If Forms!fdlgPrint!chkInclude = False Then strSQL = strSQL & " Where
[Withdrawn] = 0"
Me.subCaveat.Report.RecordSource = strSQL

"subCaveat" is the object name (not the report name) of the sub-report
on the report. The error message is:

"You entered an expression that has an invalid reference to the property
Form/Report."

The report runs fine when I don't try to set its record source at runtime.

Many thanks.

Keith.
It looks OK. If you break in the code, what happens if you did a
msgbox "Source is " & Me.subCaveat.Report.RecordSource
prior to setting the recordsource?

Maybe you can do the setting in the subreport instead of the main report.

Or perhaps you can use the same recordsource but set a filter on it from
the main report...depending on if you can access the subreport.

Nov 8 '07 #2
On Thu, 8 Nov 2007 13:41:36 -0000, "Keith Wilby" <he**@there.com>
wrote:

Not really sure, but why don't you move this code to the subreport's
Report_Open event?

-Tom.
>Why do I get this error when I run this code from a report's open event?

strSQL = "Select * from qsrptCaveat"
If Forms!fdlgPrint!chkInclude = False Then strSQL = strSQL & " Where
[Withdrawn] = 0"
Me.subCaveat.Report.RecordSource = strSQL

"subCaveat" is the object name (not the report name) of the sub-report on
the report. The error message is:

"You entered an expression that has an invalid reference to the property
Form/Report."

The report runs fine when I don't try to set its record source at runtime.

Many thanks.

Keith.
Nov 8 '07 #3
"Tom van Stiphout" <no*************@cox.netwrote in message
news:bt********************************@4ax.com...
On Thu, 8 Nov 2007 13:41:36 -0000, "Keith Wilby" <he**@there.com>
wrote:

Not really sure, but why don't you move this code to the subreport's
Report_Open event?
Hi Tom, that's where I originally put it:

Private Sub Report_Open(Cancel As Integer)

Dim strSQL As String

strSQL = "Select * from qsrptCaveat"
If Forms!fdlgPrint!chkInclude = False Then strSQL = strSQL & " Where
[Withdrawn] = 0"
Me.RecordSource = strSQL

End Sub

but I get error 2191, "You can't set the Record Source property in print
preview or after printing has started." Any clues?

Regards,
Keith.

Nov 8 '07 #4
"Keith Wilby" <he**@there.comwrote in message
news:47**********@glkas0286.greenlnk.net...

I think Access is throwing me a bum steer ... I only get that error if there
is one or more record in the sub with the "Withdrawn" flag set, regardless
of the status of the "Include Withdrawn" checkbox on the print dialog. Now
I'm really confused ...

Nov 8 '07 #5
Keith Wilby wrote:
The report runs fine when I don't try to set its record source at runtime.
What if you add a Me.Requery after setting the record source?

--
'--------------------------
' John Mishefske
' UtterAccess Editor
' 2007 Microsoft Access MVP
'--------------------------
Nov 9 '07 #6
"Keith Wilby" <he**@there.comwrote in message
news:47**********@glkas0286.greenlnk.net...
>
but I get error 2191, "You can't set the Record Source property in print
preview or after printing has started." Any clues?
Here's the answer if anyone is interested:

I was getting this error when there was more than one record in the *main*
form and needed to suppress setting the *sub's* record source more than
once.

Nov 9 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Annelies | last post by:
Hi, I want to set the recordsource of a subform to a query with this syntax : Forms!Form_patient!sub75.form.recordsource="MyQueryName" the problem is after typing sub75. I get a list of...
0
by: Vladislav Moltchanov | last post by:
Any idea, what could be reason for the following effect. Code developed in acc97 generates RunTime Error 2455 in Access 2000: claiming the Name reference is wrong: ctlLabel.Name In the SUB:...
1
by: Kirsty Ryder | last post by:
Hi, I have a Report with a subreport, and I want to assign a value to the control source of a control on the subreport depending on the value given by the user in a separate form. Based on...
0
by: Robert McGregor | last post by:
Using the follwing code and getting the error message: Run time error '2455': You entered an expression that contains an invalid reference to the property MaxRecButton. My code just...
3
by: lauren quantrell | last post by:
I have an Access 2000 form that I open showing only the header. The form's detail section visible property is set to false. The detail section contains a subform. Using a command button, I use the...
0
by: salad | last post by:
The 2455 error starts out with something like "You entered an expression that has an invalid reference..." Going to Google the general impression was that a reference was missing. At MS, there's...
3
by: iwasinnihon | last post by:
I have created a form that has a list box that displays information queried from a table. I then have a textbox under the form and three buttons under that(Add, Update, Delete). When the form is...
10
by: Anthony97 | last post by:
I get the following error message Run-time error '2455' you entered invalid reference to the property FileSearch ...
1
by: Cornishgamehen | last post by:
Hi, I seem to have discovered a bug/problematic feature in Access 2002. When navigating through records in a form, if a control in one of the subforms has the focus, and that subform becomes...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.