Full Version: Forms![formname] Gives Error 2450
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
cocoflipper
Hi all,

I'm running into this situation with only 1 of 30 clients running my application.

When I open any of the reports in my application, I refer to the form opening the report so I can refer back to the form to refer to it or its controls when the report is opening or closing. I do this with the following code:

Dim frm as Form
Set frm = Forms![frm_MyForm]

This works fine for 29, with the other one they will get the error 2450 - Microsoft Access can't find the form 'frm_MyForm' referred to in a macro expression or Visual Basic Code. The client getting the errors is running Access 2007 on Office XP SP3.

Anyone know why this is?
GroverParkGeorge
For that code to work the form in question must be open at the time it runs. Long shot here, but is your user sure the form was open when they got that error?

cocoflipper
QUOTE (GroverParkGeorge @ Mar 1 2010, 10:42 PM) *
For that code to work the form in question must be open at the time it runs. Long shot here, but is your user sure the form was open when they got that error?


OK - looked a little closer at my code. My form calls a module called ProcessReports. This module handles the different nuances with my reports when they open. The module sets the form visible property to False, but that's all it does to the form before a DoCmd.OpenReport proc opens the particular report. Could it be that because the module is out of scope that the form reference cannot be set? The form should still be there, right? Just set as not visible

Thoughts?
GroverParkGeorge
With regard to your specific question, I think that whether the form is visible or not, the code should work.

We probably should be looking for something outside the code itself, because it works on 29 out of 30 installations. That usually points to something in that workstation which is different from the other 29. Hence my question about whether the form is actually open, as expected. Other things to consider are versions and service pack differences. However, my gut tells me you need to find out if that user is doing something different from the other 29.

cocoflipper
QUOTE (GroverParkGeorge @ Mar 1 2010, 11:25 PM) *
With regard to your specific question, I think that whether the form is visible or not, the code should work.

We probably should be looking for something outside the code itself, because it works on 29 out of 30 installations. That usually points to something in that workstation which is different from the other 29. Hence my question about whether the form is actually open, as expected. Other things to consider are versions and service pack differences. However, my gut tells me you need to find out if that user is doing something different from the other 29.


Hmmm....that may be easier said than done, as these users are remote and I'm not there to review their interaction with the application. The error logging that I do is FTP'd from the tables in their backend db to the web site, and viewed by me later. It's a process I just created, so I may be able to get these errors sooner as I move forward. The errors I'm referencing are for code that is still in place, so I'll have to see how they use it going forward.

Thanks, though. Please be sure to visit my other unanswered posts! grin.gif
cocoflipper
Think I found what this was....possibly.

Since I refer to the form in other procedures, I've recreated instances where the OnOpen event of the report occurs when the form object I create to use within the report, not the form itself, no longer exists at that moment. Such cases usually occur when there is an unhandled error, so I think my task will be to find out where my error trapping is thin.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.