code for closing form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
S Kahn said:
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
 
Arvin said:
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.
 
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
 
Back
Top