By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,998 Members | 2,837 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,998 IT Pros & Developers. It's quick & easy.

Error 2455 referring to subform

P: 2
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
Share this Question
Share on Google+
3 Replies


NeoPa
Expert Mod 15k+
P: 31,492
What's the name of your Subform control Jeremy?

Interesting question BTW ;-)
Feb 3 '12 #2

P: 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
Expert Mod 15k+
P: 31,492
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

Post your reply

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