close form when main form closes (1 Viewer)

Jacqueline

Registered User.
Local time
Yesterday, 23:57
Joined
Jul 22, 2015
Messages
10
Is there an easy way, using the edit tools in Access 2016 (I'm not comfortable in visual basic) to close a secondary form when I close the primary form.



Here is my design. I have a DB that combines information from read-only tables with tables I created for my faculty to track data. The first form is a filter selecting from the Read tables to pull their current quarter schedule. Next, they pull up a form based on the table where they can record data for students. They have to input some data from the read-only table, making it easier for them using the copy paste the data from the read-only tables to the data entry from.



I would like the first (call it the filter form) to close when they finish and close the student data entry form. Is this possible?

Thanks for any help

Jacqueline
 

June7

AWF VIP
Local time
Yesterday, 22:57
Joined
Mar 9, 2014
Messages
5,468
Requires code (macro or VBA).

Could make second form modal so cannot return to main form without closing second form first.

Copy/paste from read only tables? Why duplicate data? Why not join tables in query to retrieve related info?
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 07:57
Joined
Sep 12, 2006
Messages
15,648
You can iterate the forms and close them all with a simple bit of code.

However, the trouble comes when the second form hasn't been completed. What do you want to do then?


So a better alternative might be to first test whether any of the open forms are dirty, and if so inofrm the user they need toi deal with the dirty from first.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:57
Joined
May 7, 2009
Messages
19,228
add a Macro on the Form's Unload or Close Event.
the macro should look like:
Code:
OnError
           Go to: Next
           Macro Name:
CloseWindow
           Object Type: Form
           Object Name: theNameOfTheFormHere
           Save: No
 

Users who are viewing this thread

Top Bottom