Microsoft Access 2010 close form problem

breauxlg
breauxlg used Ask the Experts™
on
I have an access database that works under 2003 and 2007, but in 2010, I get this error:
Microsoft Access cannot find referenced form '|1'. I am closing the form in a Macro that does some posting functions, and then when done, the last thing the macro does is close the form. I see that 2010 changed the close command to the closewindow command, but I have no idea why this will not work or how to fix it.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Bill RossProgrammer

Commented:
Please post you code so we can help.

Thanks,

Bill

Author

Commented:
It's a Macro - on the older office, it looks like this:
Action Close
Object Type Form
Object Name PO
Save Prompt
On Office 2010, it looks like this:
Action CloseWindow
Object Type Form
Object Name PO
Save Prompt
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
First run the Compact/Repair Utility.

Then, check your spelling of the assciated objects.
(many times an object is renamed and the Macro is not updated)

Please try to avoid using Macros, most developers do not use them...
Try this in VBA Code first:

    Docmd.Close

If this works, then we can figure out if the other argumnets are needed...


:-)

JeffCoachman
Should you be charging more for IT Services?

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Commented:
Found the problem. Had macro with conditions calling other macros.  Like this:
If Form!FormName!ControlName = "Something" execute macro1
If Form!FormName!ControlName = "SomethingElse" execute macro2
If Form!FormName!ControlName = "SomethingDifferent" execute macro3

Macro1, 2 and 3 each had the close form command in them. What was happening was that macro1 was issuing the close form and the error was coming about in response to the second If statment, not from the close statement. The limited troubleshooting information from the Macro didn't indicate which statement was causing the problem. You're right, I need to convert these macros to VB asap. Thanks anyway, Lynn

Author

Commented:
However, this worked fine on 2003 and 2007.
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
OK

You can now accept your own post as the solution
;-)

Jeff

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial