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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The expression you entered refers to an object that is closed etc.

Status
Not open for further replies.

paulwood

IS-IT--Management
Apr 10, 2001
896
0
0
GB
I have a form which calls another form which then closes the original form when it loads. Except it doesn't. I am using the code
Code:
Private Sub Form_Load()

DoCmd.Close acForm, "NameOfFirstForm"

End Sub

but I get the error "the expression you entered refers to an object that is closed or doesn't exist", although the first form does actually close at this point. If I comment the code out, I don't get the error but the first form doesn't close either. I have checked and there is only one instance of the code so it's not trying to do the same thing twice. Any ideas?
 
I would recommend NOT closing the First from from the second. Instead, in the code on the first form where you open the second, have it close itself...Something like:

DoCmd.OpenForm "Form2"
Docmd.Close acForm, Me.Name

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top