473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Error 2455 referring to subform

I have been using successfully FishVal's code on http://bytes.com/topic/access/answer...vent-main-form to 'hook' subform events into VBA code on the parent form - Access 2010.

This all works fine, until changing the query to add a table that has a many-to-one relationship with the original table. If this is in place, AND the query has a condition that selects no records, then there is an error triggered in the form load event. "Run-time error '2455': You have entered an expression that has an invalid reference to the property Form/Report."

I have cut the problem down to the absolute minimum that causes the error - in the attached file.

The VBA code is:
Expand|Select|Wrap|Line Numbers
  1.     Private WithEvents frmSMSSubform As Access.Form
  2.  
  3. Private Sub Form_Load()
  4.         Set frmSMSSubform = Me.subform.Form
  5. End Sub
  6.  
and the error message occurs on the SET line. Can anyone explain this?


I can find a workaround but would like to understand what is going wrong.

Thanks

main form event from subform data.zip
Feb 3 '12 #1
3 4906
NeoPa
32,556 Expert Mod 16PB
What's the name of your Subform control Jeremy?

Interesting question BTW ;-)
Feb 3 '12 #2
The name of the subform control in this cut-down example is just 'subform'. Originally it was something more descriptive, of course.
Feb 3 '12 #3
NeoPa
32,556 Expert Mod 16PB
Nothing occurs I'm afraid Jeremy.

I see you have already anticipated most of what is required for posting an attachment (Attach Database (or other work)), but I was unable to look at your database as i'm not yet using 2010. If you'd like me to look at it in detail for you, you could post a 2003 version. Up to you of course :-)
Feb 3 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

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:...
7
by: kevin.jonas | last post by:
Let say I have a form called "frmMachineSpecs" witht wo subforms, "frmSpecs" and "frmMachines". Both subforms are in datasheet view. The first control in "frmSpecs" is "txtOEM_No". I want to...
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...
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...
2
by: Anthony England | last post by:
I wonder if anyone would have 5 minutes to check this for me. Access XP with new database created: Simple table tblTest: ID=autonumber, F1=Text with a few sample records frmSub has this as its...
2
by: David W. Fenton | last post by:
I think at various times we've all encountered this problem: A subform is on a main form. From the code of the main form we refer to some property of/control on the child form thus: ...
6
by: Keith Wilby | last post by:
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 = 0"...
5
by: gershwyn | last post by:
I'm trying to make a very simple order form. I have two tables - OrderHeader has information specific to the order itself, such as company name and order date. OrderDetail contains details such as...
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.