Solved

Run-time error '2450'

Posted on 2011-02-18
9
655 Views
Last Modified: 2012-05-11
I'm loading a form from another form (Main_Menu) using this code attached to a button event:

Me.Visible = False
DoCmd.OpenForm "Module_Menu"

This works well, but when exiting the form, I have code attached to another button to close out and return to the main menu (simple enough supposedly):

Forms!Main_Menu.Visible = True
DoCmd.Close

At that point I get the run-time error '2450'  Access can't find the form 'Main_Menu' referred to in a macro expression or Visual Basic code.

Hopefully it's a simple fix--yet it's become very frustrating.

Thanks in advance for your assistance....
0
Comment
Question by:dhjensen
  • 4
  • 4
9 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 334 total points
Comment Utility
do a compact and repair of the db.

then from VBA window, do
Debug >Compile
correct any errors raised

test
0
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 334 total points
Comment Utility
also check if name of the main form "Main_Menu" have an underscore or a space,
if a space you need to enclose he name in brackets

Forms![Main Menu].visible=true

0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 166 total points
Comment Utility
also make sure to carefully check your spelling of these names in your actual db.
Main_Menu
Mian_Menu

This is a common error with mis-spellings...

Also make sure there is no code anywhere that actuality closes the Main Menu
0
 

Author Comment

by:dhjensen
Comment Utility
Compacted & repaired database, and compiled.  Made a few corrections, but still having the same issue.

I'm going to export the form, delete it, compact db, and re-install the form.  I'm open to any other thoughts....
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
can you upload your db..
0
 

Author Comment

by:dhjensen
Comment Utility
Unfortunately not.
0
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility

try this codes

create a global variable in a regular module

public CalledBy as string
------------------------------

from the main form, opening the other form

Me.Visible = False
DoCmd.OpenForm "Module_Menu", openArgs:=Me.name



in the load event of form "Module_Menu" place this codes

private sub form_load()

if me.openargs & ""<>"" then
  CalledBy=Me.OpenArgs
end if

end sub


in closing the form "Module_Menu" , use this codes

Forms(CalledBy).Visible=True




0
 

Author Comment

by:dhjensen
Comment Utility
OK, reversed the lines in the exit buttom from:

Forms!Main_Menu.Visible = True
DoCmd.Close

---to---

DoCmd.Close
Forms!Main_Menu.Visible = True

and it works now.

Apparently, the Main_Menu was "visible" just behind the existing screen, and probably had focus, and was probably closing (couldn't see it so it's hard to tell for sure).  

The error 2450 happened after pressing the button again (nothing was appearing to happen.)

I'll split the points for your assistance.  It's very much appreciated.

In the mean time, I'll kindly accept the Dumb*** of the Week Award--thankfully, it's Friday.
0
 

Author Closing Comment

by:dhjensen
Comment Utility
Thanks for the assistance!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now