Solved

Run-time error '2450'

Posted on 2011-02-18
9
660 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
ID: 34927953
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
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
 

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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 119

Expert Comment

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

Author Comment

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

Expert Comment

by:Rey Obrero
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Print focus keeps focusing to the caller form 3 25
Contents of subform based upon combobox value 3 24
Field behavior for "locked" form 12 29
Query design issue 2 21
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

919 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

21 Experts available now in Live!

Get 1:1 Help Now