Solved

Run-time error '2450'

Posted on 2011-02-18
9
688 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 334 total points
ID: 34927953
do a compact and repair of the db.

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

test
0
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 334 total points
ID: 34927974
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
ID: 34928236
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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:dhjensen
ID: 34928330
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
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34928512
can you upload your db..
0
 

Author Comment

by:dhjensen
ID: 34928562
Unfortunately not.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34928638

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
ID: 34928769
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
ID: 34928804
Thanks for the assistance!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

740 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