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

Close Form from loaded form at DB startup

Status
Not open for further replies.

northernbeaver

Programmer
Jul 9, 2001
164
CA
I have an mdb and I have set the startup option to load frmsplash. on the form load of frmsplash I call a public Sub that checks a few tables to verify that there is data in them. IF data doesnt exsist a text box is filled with text, three buttons are shown on the form and it ends there until data is found.

if data is found in the three tables in question I want a form called frmMenu to be opened and in the Load event of the frm menu I use the docmd.close command to close the frmsplash form as its not needed anymore. so again to recap:

on startup of mdb-frmSplash is called

On load of frmsplash I call the public sub to check the state of three tables.

if data doesnt exsist do nothing
if data does exsist then load frmMenu and close frmsplash

Here is what happens when data exsists. the frmMenu loads as itshould but the frmsplash form will not close. Ive made sure that the frmMenu is given focus, Ive doublechecked my spelling in my code. if I step through the code no errors are hit and the docmd.close. acform,"frmSPlash" command is run but the for will not close. I find it interesting that it has focus when all is said and done. anyone know what could be causing this? and why I cant get this form to go away? thanks



 
Try adding the line:
DoCmd.Close
To the code in frmSplash just before you open frmMenu. i.e.

DoCmd.Close
DoCmd.OpenForm "frmMenu"

This will cause frmSpalsh to close itself (because it has the focus) and then open frmMenu.

Hope this helps.

P.S. Make sure that any functions that frmSplash calls have completed before trying to close the form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top