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

open and close a form in same sub routine 1

Status
Not open for further replies.

rhinomac

Programmer
Jan 24, 2003
34
US
How can i open a new form and close the form that i'm in using a button click action.

It seems like it something obvious but im just overlooking. Heres what im trying to do now and it just keeps closing the form that im in.

DoCmd.OpenForm "shippedform"
DoCmd.Close
 
Off hand I would say that you need to ensure focus for the close. Maybe do a

DoCmd.OpenForm "shippedform"
Forms!Employees!EmployeeID.SetFocus
DoCmd.Close


Note the set focus is on the form u wish to close



Jeremy
WZ
 
thanks bro should of known.
Appreciate it...
-Rhino
 
You could also skip worrying about the focus and specify the name of the form... I've taken the liberty of including acSaveNo so the user doesn't save changes to the form. This means you need to be careful when developing and making changes but it works best for me.

DoCmd.OpenForm "shippedform"
DoCmd.Close acForm, Me.NAME, acSaveNo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top