Runtime error 2455

silentwolf

Well-known Member
Joined
May 14, 2008
Messages
1,216
Office Version
  1. 2016
Hi guys I have following situation,

I created a sfmKopf which has in the detailed section a logo and a label.
On the load event of this form I got this code.
Code:
Private Sub Form_Load()
    LadeGrafikImage Me.imgLogo, "MyLogo-Logo-Mail.bmp"
    LadeGrafikButton Me.btnSchliessen, "close.png"
End Sub

I have also created a sub procedure with following code

Code:
Sub SetzeFormularKopf(sfmDieserKopf As Form_sfmKopf, strTitel As String)
    sfmDieserKopf.lblTitel.Caption = strTitel
    On Error Resume Next
    sfmDieserKopf.Parent.Caption = "Formular: " & strTitel
    sfmDieserKopf.Detailbereich.BackColor = sfmDieserKopf.Parent.Formularkopf.BackColor
End Sub

So what I did is I got this sfmKopf and have inserted this form in the formHeading of other forms...
on the load event of each form I got this on load event..

Code:
Private Sub Form_Load()
    SetzeFormularKopf Me.sfmKopf.Form, "Mitarbeiter Niederlassung"
End Sub

Now in some forms when I loade this event I have no problem but on a some I get the runtime error of 2455

RunTime Error 2455
You have entered an expression that has an invalid reference to the property Form/Report.

I have exactly the same line of code in all forms well accept the string "Mitarbeiter Niederlassung"

does anybody can think of a solution to this problem?

Many thanks for help!

Silentwolf
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
I'm 99.95% English speaking, so forgive me if I don't completely understand the relationships between the code samples. It is likely that the problem is the syntax used to reference the object property, or the property you are trying to modify is not a property of the object. In your post, you should label the line where the error occurs to give us a better chance to pinpoint the problem. To try to address the first issue, I have these notes for referencing subform properties and subform controls (I presume smfKopf is a sub form):
referencing CONTROLS on subform:
[Forms]![Main form name]![subform control name].[Form]![control name on subform]

e.g.
[Forms]![frmNP]![subNPfrm].[Form]![txtNPno]
frmNP is main form name
subNPfrm is name of subform control on frmNP
txtNPno is the textbox control name

referencing subform PROPERTY (e.g. recordset property such as Recordcount):
forms("MainFormName").Controls("subformControlName").Form.Recordset.Recordcount
e.g. Forms("frmWhoUsesVendor").Controls("subWhoUsesVendor").Form.Recordsource
NOTE: subformControlName IS NOT THE SUBFORM NAME

Added point: I'm not sure I'd have a load event on a subform as well as a main form. As far as I know (AFAIK) Access loads subforms first, then the main form, so consider that when you analyze what you think is happening first in the order of events. You might want to consider affecting subform form or control properties from code on the main form by incorporating the above syntax examples. Sorry that I'm guessing so much, but it's because of my incomplete understanding of what you posted. Not your fault that I'm not multi-lingual!
 
Upvote 0

Forum statistics

Threads
1,221,829
Messages
6,162,229
Members
451,756
Latest member
tommyw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top