close a previous form automatically

A

Al De

I have taken over somebody's project creating an Access Database. As new
forms are opened, the previous ones stay open also. How do I close them
automatically when a new one is opened (like the sign in form)?
 
C

Cheech73

If you are using a command button to open the new form, include a "close
form" command as a secondary command on the referring button's macro.
-Good luck
 
R

RobFMS

The statement you are looking for is: Docmd.Close

Sample Syntax:

1) Docmd.Close ObjectType:=acForm, ObjectName:=Me.Name

or

2) Docmd.Close acForm, Me.Name

Me.Name is the active form.. or you can specify the form name in quotes,
like this:
Docmd.Close acForm, "Form1"

HTH
--
Rob

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top