Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

lost reference (error 2467)

Status
Not open for further replies.

SimonSellick

Programmer
Nov 3, 2003
305
GB
Hi,

A few threads have this error number but none seems to address the same issue.

The process runs as an event handler on a form. It opens a dialog form (a progress bar mostly) then when it completes, closes the dialog form and writes a completion message to a label on the calling form, which is still open.

All is well unless I change focus away from Access during the process. In that event, the attempt to write the completion message fails with the error 2467 and the message 'The expression you entered refers to an object that is closed or doesn't exist.'

The statement that fails is simple:

Code:
Private Sub Status(s As String)

    [red]lblStatus.Caption = s[/red]
    
End Sub
If I debug when it has failed, the immediate window shows that the calling form is available as 'Me' and shows its controls and properties, but it can't actually get at them - an attempt to print one repeats the error.

Any ideas, anyone?
 
I tried a mock-up, which consisted of FormA, with this code:
Code:
Private Sub Status(s As String)
    lblStatus.Caption = s
End Sub

Private Sub Detail_Click()
DoCmd.OpenForm "FormB", acNormal, , , , acDialog
Call Status("Done")
End Sub

And FormB which simply closed on a timer (interval 3000)
Code:
Private Sub Form_Timer()
DoCmd.Close
End Sub

Switching away from Access did not cause any problems. [ponder]
 
Thanks for the reply Remou.

I tried your code and it works OK here too, so I'll experiment with some of the extra code to see when it starts falling over, and report back.

Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top