?
Solved

Run-time error '2450'

Posted on 2011-02-18
9
Medium Priority
?
700 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 1336 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 1336 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 664 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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 

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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Suggested Courses

801 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