Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invalid Reference to property Form/Report Error 1

Status
Not open for further replies.

cstuart79

Technical User
Nov 2, 2009
171
US
Help!
Whenever I try to open my database I get the following error:

Run-time error '2455': You entered an expression that has an invalid reference to the property Form/Report.

The following line is highlighted:

Me.TabCtl88.Pages ("ROTO-Weehawken").Visible=Me.Services_Key.Form.chkROTO_Weehawken.Value

Below is the complete code:

Private Sub Form_Current()
Me.List367.Selected(Me.List367.ListCount) = True
Me.TabCtl88.Pages("ROTO-Weehawken").Visible = Me.Services_Key.Form.chkROTO_Weehawken.Value
Me.TabCtl88.Pages("ATS-Weehawken").Visible = Me.Services_Key.Form.chkATS_Weehawken.Value
Me.TabCtl88.Pages("Certification").Visible = Me.Services_Key.Form.chkCertification.Value
End Sub

CLIENTS: current Form
List367: list on Form CLIENTS
TabCtl88: main Tab
ROTO-Weehawken: Tab 2 name
chkROTO_Weehawken: check box on Services_Key to make Tab visible
Services_Key: subform on Form CLIENTS
ATS-Weehawken: Tab 3 name
chkATS_Weehawken: check box on Services_Key to make Tab visible
Certification: Tab 4 name
chkCertification: check box on Services_Key to make Tab visible

 
How are ya cstuart79 . . .

Try this syntax:
Code:
[blue]Me.TabCtl88.Pages ("ROTO-Weehawken").Visible = [purple][b][Services_Key].Form!chkROTO_Weehawken[/b][/purple][/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
AceMan, tried your suggestion but it is still complaining....
 
this error is only generated when i utilize followhyperlink to open up DB from another DB. when i open it manually there is no complaint.
 
i have 3 differnet DB's all linked together via application.followhyperlink .....:

GES_CLIENT_DATABASE.accdb (MAIN)
US_DATABASE.accdb
EU_DATABASE.accdb
Asia_DATABASE.accdb

3 of the DB's (US, EU, Asia) have identical names for the following:

CLIENTS: current Form
List367: list on Form CLIENTS
TabCtl88: main Tab
ROTO-Weehawken: Tab 2 name
chkROTO_Weehawken: check box on Services_Key to make Tab visible
Services_Key: subform on Form CLIENTS
ATS-Weehawken: Tab 3 name
chkATS_Weehawken: check box on Services_Key to make Tab visible
Certification: Tab 4 name
chkCertification: check box on Services_Key to make Tab visible

Do these need to be unique or do I need to specify which DB is referred to in VBA? i didn't think it would matter if similar names were in separate DB's.....
 
cstuart79 . . .

I don't have 2007 so I can't test properly. Despite that I can find no reason why it doesn't work. The caveat or monkey-wrench here is that you say:
[blue] ... when i open it manually there is no complaint.[/blue]
Do you get the same results with one of the db's open and you open the db in question thru [blue]windows explorer?[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
yes, i am able to open any of the 3 DB's even while another one is already open, if i manually select.....
however, when using the code below to "switch" between DB's i get the error:

Private Sub Command510_Click()
Application.FollowHyperlink "Z:\GES\Client Database\Asia_DATABASE.accdb"
Application.Quit
End Sub

Private Sub Form_Activate()
DoCmd.Maximize
End Sub

Private Sub Form_Current()
Me.List367.Selected(Me.List367.ListCount) = True
Me.TabCtl88.Pages("ROTO-Weehawken").Visible = Me.[Services_Key].Form.[chkROTO_Weehawken].Value
Me.TabCtl88.Pages("ATS-Weehawken").Visible = Me.[Services_Key].Form.[chkATS_Weehawken].Value
Me.TabCtl88.Pages("Certification").Visible = Me.[Services_Key].Form.[chkCertification].Value
End
 
I do not know if this is a bug, but there has been a lot of posts on this error. often the error is sporadic, or works fine for a long time and then starts occuring. If you google this error you will find a lot of occurences and workarounds. However, most of the workarounds never seem to answer why or make much sense. I believe it is some kind of timing issue. It often has to do with the load order of the subforms.

I would try two thing add doEvents and then set focus to the subform control. I read two cases where this solved the problem.
 
tried setting focus on Me.Services_Key.SetFocus to no avail.
tried adding control SubFormControl on Services_Key and setting focus Me.Services_Key.Form.SubFormControl.SetFocus to no avail.

wasn't sure where doEvents should go or what it is supposed to specify....
 
cstuart79 . . .

Perhaps
Code:
[blue]   Me.List367.Selected(Me.List367.ListCount) = True
   [purple][b]Me.Services_Key.SetFocus
   Me.Services_Key.Form.chkROTO_Weehawken.SetFocus
   DoEvents[/b][/purple]
   Me.TabCtl88.Pages("ROTO-Weehawken").Visible = Me.[Services_Key].Form.[chkROTO_Weehawken].Value
   Me.TabCtl88.Pages("ATS-Weehawken").Visible = Me.[Services_Key].Form.[chkATS_Weehawken].Value
   Me.TabCtl88.Pages("Certification").Visible = Me.[Services_Key].Form.[chkCertification].Value[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
The more I google this error the more bizarre it is. If you find a solution please post. It seems to manifest in many ways, and the fixes really seem to have nothing to do with what you would expect.

If the above does not work I would consider something like this

public subFrm as access.form

Private Sub Form_Load()
set subFrm = Me.Services_Key.Form
End Sub

then use "subFrm" in your code in place of "Me.[Services_Key].Form"

That way if you can set it in the load event of the main form, you should never be able to lose a reference to it.
 
Setting Focus didn't work since it seems to be complaining specifically about Me.Service_Key.Form.chkROTO_Weehawken.....
Setting subFrm didn't work either since it complains that form is "ambiguous".....
I am really at a loss here since there is absolutely no problem when opened manually.?????
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top