This is the senario;
----
I have a "Main" form in which an entry on a drop down selects one of three types of test.
The type of test designates the type of form used to enter the data.
Therefore when my drop down select type 2 from its field or if the user uses the navigation to move through the records, the system must look at the drop down and see if it = the number 2 if it does then close the "Main" form and open the "Superform" (The name is abitrary).
Likewise if the user moves off the "Superform" using the nave buttons or changing the state of the drop down the reverse is applied, the Superform closes and Main opens.
-----
Sounds simple right?
So we need to look at the Main form after its been selected using the nav buttons examine the drop down see if its a "2" and close main, open Superform.
OR
If the state of the dropdown changes to a "2" then close main, open superform
Else
do nothing
This is the code I'm using on the superform when the drop down state is changed which works fine.
Expand|Select|Wrap|Line Numbers
- Private Sub CBO_MachineSpecification_AfterUpdate()
- If ([MachineSpecification] = 2) Then
- DoCmd.OpenForm "Superform", acNormal, , , acFormEdit, acWindowNormal
- DoCmd.Close acForm, "Main", acSaveYes
- Else
- DoCmd.OpenForm "Main", acNormal, , , acFormEdit, acWindowNormal
- DoCmd.Close acForm, "Superform", acSaveYes
- End If
- End Sub
Run-Time error '2585' (This action cannot be carried out while processing a form or report event.) as the Main form attempts to be closed.
Huh? So Close takes no account of the state of the item it's closing? It doesn't wait until the form has completed its housekeeping before trying to shut it down?
Where am I going wrong?