• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1971
  • Last Modified:

Runtime error 2467 Woes PLEASE HELP!!

I have a user that is doubting my system because of stupid runtime error 2467 (refers to object that does not exist) The error happens every second time certain forms are started.

I have code in the "On Current" event of main forms that triggers certain events in subforms. These triggers are neccesary...like text box locks, label visible etc.

For some reason the code runs before the subform opens (only every second time) The user closes the error window and opens the form. I can trap the error to be ignored I suppose but I am worried that I can end up with corrupted data.

The ideal solution would be to insure the subs always open before the code runs...how is this possible?

Or do you have another "easy" solution to this annoying problem? To me the Access Design Team should have this as built in functionality, but what do I know? :o/

The bottom line is why every second time? Seems Access changes the way it launches forms each time they open. A bug perhaps?

I DO have service pack release 2 installed so that doesn't help.

HELP
arrrgh

ToddMac
0
ToddMac
Asked:
ToddMac
  • 3
  • 2
  • 2
  • +2
1 Solution
 
brewdogCommented:
that goes against everything I've heard and experienced with form/subform combos. I have an app out there now that has six subforms -- and I do the same kind of enabling/disabling/moving focus etc on all of them on form current, with no problems. The subforms are *always* supposed to load before the main form. Are you closing the form in a normal fashion between the first and second times you open it?
0
 
Ghis68Commented:
Whit out more information on the procedure.  The only thing I can suggest in the event on current where the error append try to add this.


Dim X as integer
For X = 1 to 50
   DoEvents
next

Just to give more time to Ms Access... to do ???
0
 
threeps99Commented:
The full error message for that is:

You entered refers to an object that is closed or doesn't exist.@For example, you may have assigned a form to a Form object variable, closed the form, and then referred to the object variable.@@1@@1

Are you sure your not closing hiding the form and not closing it?
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
jdesharnaisCommented:
Are you running win NT?
I have had this happento me also. What I found is because NT is multitheaded  the subform was not quite loaded yet(i should be though) when you get to the "on current" event of the main form.

Ghis68 solution may work? I sound like it might.

What I do has add a timer interval of  200 (as long as it is a bit).  

Private Sub Form_Timer()
       Form_Current()
        TimerInterval = 0
end sub

0
 
ToddMacAuthor Commented:
To answer the NT question one machine is NT but the main user machine is running Win98. Personally I think that operating systems sucks and it is not as stable as Win95. As for the WinNT workstation...I think the designers at Microsoft were sniffing glue when they designed that piece of junk...but that is another story.

I will try the timer event and get back to you. I did add error handlers in spite of my earlier statement and they seem to be doing okay, but I have a nagging suspicion it will cause corruption someday.

As for the forms opening and closing in the usual way...yes that is the case. I have a command button that has the following in the OnClick event:

DoCmd.OpenForm "frmTicket"

I also have some created by wizard as follows:

On Error GoTo Err_cmdDelUSA_Click

Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmDelTickUSA"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
   
Exit_cmdDelUSA_Click:
    Exit Sub

Err_cmdDelUSA_Click:
    MsgBox err.Description
    Resume Exit_cmdDelUSA_Click

Doesn't matter which way I code it the same thing happens.

Brewdog I find it strange that I am getting these errors and you are not. Could the fact that I did some development on the NT machine be the cause?

On another matter what is the story with "Save Failed"? I get this every now and then when I do a save. It always work on the second try...

Hmmm second try...could there be a connection?

I think there is a bug in the software!

Also Brewdog, for your info I have not had a chance to get to the search function yet. Sorry man

ToddMac
0
 
brewdogCommented:
no problem on the search function thing. I had forgotten about it. :o)  A few too many questions in the brain right now anyway.

My system with six subforms was designed entirely on an NT box, though it's running on a 95 machine with Novell network with no real problems, either. (I had to tweak a couple things, but nothing major.) I would be mighty frustrated if because of NT's "multi-threading" a subform wouldn't load before a main form.
0
 
Ghis68Commented:
The Event On Open is trigger before the Event On Current
You can trap the error in this procedure and do a loop until you don't have the error
this should be save an your On current procedure will work perfectly

On error resume next

Me![subform].form![field].locked =true  'Something causing the error
Do Until Err = 0
    Err = 0
    debug.print Me![subform].form![field]
Loop
0
 
jdesharnaisCommented:
I forgot to tell you something.

set up a boolean variable
it the on current event add something like

if firstflag = true then
 subform stuff
else
 firstflag = true
end if

0
 
ToddMacAuthor Commented:
Folks thanks for all the help...I am having success with Ghis68' solution. Lock in your points man

Thanks

ToddMac
0
 
Ghis68Commented:
The Event On Open is trigger before the Event On Current
       You can trap the error in this procedure and do a loop until you don't have the error
       this should be save an your On current procedure will work perfectly

       On error resume next

       Me![subform].form![field].locked =true  'Something causing the error
       Do Until Err = 0
           Err = 0
           debug.print Me![subform].form![field]
       Loop
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now