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 Programming / March 2005

Tip: Looking for answers? Try searching our database.

Open 1 form and close another with command button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ozzwald - 10 Mar 2005 12:31 GMT
Hi,

I want to be able to close 1 form and open another form that displays the
result of the first form, but  I have no idea how to do it! I tried various
options in VB but with no joy.
Rick Brandt - 10 Mar 2005 12:46 GMT
> Hi,
>
> I want to be able to close 1 form and open another form that displays
> the result of the first form, but  I have no idea how to do it! I
> tried various options in VB but with no joy.

DoCmd.Close acForm, "FormName"
DoCmd.OpenForm "OtherFormName"

Signature

I don't check the Email account attached
to this message.     Send instead to...
RBrandt    at       Hunter      dot      com

Steve - 11 Mar 2005 11:41 GMT
Rick:
But if this code is part of "FormName" (the 1st form), would the 2nd
line to open "OtherFormName" still be run?

Steve

>>Hi,
>>
[quoted text clipped - 4 lines]
> DoCmd.Close acForm, "FormName"
> DoCmd.OpenForm "OtherFormName"
Rick Brandt - 11 Mar 2005 12:46 GMT
> Rick:
> But if this code is part of "FormName" (the 1st form), would the 2nd
> line to open "OtherFormName" still be run?

Yep.  The code in a form will continue executing to the end even if the very
first line is to close the form containing the code.  This would not be true for
code like the following...

Sub TestSub

some code...
DoCmd.Quit
some more code...

End Sub

In the above the Quit command will definitely prevent any further lines from
executing because Access itself is being closed.  A form or report however does
not have this problem from being closed.

Signature

I don't check the Email account attached
to this message.     Send instead to...
RBrandt    at       Hunter      dot      com

 
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.