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 / December 2005

Tip: Looking for answers? Try searching our database.

code for closing form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
S Kahn - 18 Dec 2005 15:57 GMT
On formSelect I use cmdOpen button to open another form (formData).
Appreciate any code that I can use to close the current form i.e. formSelect
when I click the cmdOpen button.
Thanks
S Kahn
DigiVamp - 18 Dec 2005 16:35 GMT
Not sure I'm reading from the same page but how about;
writing the code for the command button on click to be
DoCmd.Close
DoCmd.Openform "NewFormToOpen

--
DigiVampPosted from - http://www.officehelp.i
Arvin Meyer [MVP] - 18 Dec 2005 17:16 GMT
You've got it backwards. If you close the current form, you can't open
anything from it.

BTW, you need to set your computer's clock. It is running slow.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

> Not sure I'm reading from the same page but how about;
> writing the code for the command button on click to be
[quoted text clipped - 3 lines]
> --
> DigiVampPosted from - http://www.officehelp.in
Rick Brandt - 18 Dec 2005 17:29 GMT
> You've got it backwards. If you close the current form, you can't open
> anything from it.

Actually you can issue the DoCmd.Close first and any code lines that follow it
are still executed.

Signature

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

S Kahn - 18 Dec 2005 18:18 GMT
Thanks all, works great.

S. Kahn
Arvin Meyer [MVP] - 19 Dec 2005 03:17 GMT
> Actually you can issue the DoCmd.Close first and any code lines that follow it
> are still executed.

Right you are. This obviously must be an exception to the general rule of VB
and VBA supposedly executing sequentially, with each statement finishing
before the next starts. I tried adding a delay loop between statements to
see if it would react as expected. It still finishes. Good catch.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
Arvin Meyer [MVP] - 18 Dec 2005 17:02 GMT
> On formSelect I use cmdOpen button to open another form (formData).
> Appreciate any code that I can use to close the current form i.e. formSelect
> when I click the cmdOpen button.

Simply open and close the forms. From a button:

   DoCmd.OpenForm "Form To Open"
   DoCmd.Close acForm, "Form To Close"
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
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.