Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / March 2008

Tip: Looking for answers? Try searching our database.

Closing a form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jerry Anderson - 21 Mar 2008 18:43 GMT
I have a form that opens another form based on a selection from a list box.
Loading the new form is triggered by the AfterUpdate event. After the new
form opens, what is the code to close the original?
Dirk Goldgar - 21 Mar 2008 18:55 GMT
>I have a form that opens another form based on a selection from a list box.
> Loading the new form is triggered by the AfterUpdate event. After the new
> form opens, what is the code to close the original?

The code that opens the new form can also close the current form:

   DoCmd.OpenForm, "frmNewForm"
   DoCmd.Close acForm, Me.Name, acSaveNo

The above code uses the current form's Name property to supply the name of
the form to be closed.  If you want to close some other form, say "FormB",
you could write:

   DoCmd.Close acForm, "FormB", acSaveNo

The acSaveNo argument instructs Access not to save any design changes to the
form.  Note that it has nothing to do with saving any modified *data* on the
form -- that will happen automatically when you close the form, so long as
there's nothing (data validation errors, for example) to prevent it.

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Jerry Anderson - 21 Mar 2008 19:31 GMT
> >I have a form that opens another form based on a selection from a list box.
> > Loading the new form is triggered by the AfterUpdate event. After the new
[quoted text clipped - 15 lines]
> form -- that will happen automatically when you close the form, so long as
> there's nothing (data validation errors, for example) to prevent it.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.