Steve R.
Retired
- Local time
- Today, 16:56
- Joined
- Jul 5, 2006
- Messages
- 4,617
I am testing for the highly improbable situation where I have ZERO records to display. I have a pending form that lists all PENDING PROJECTS. When clicking on a project number an edit form pops-up. One of the things that the edit form allows is project completion. When the edit form completes it returns the user to the PENDING PROJECTS form. In the event that the user has just completed the last project the PENDING PROJECTS form would have no records to display and should be automatically closed.
When returning to the PENDING PROJECTS form, the activate event is triggered. However, I get the "Run time Error 2585" message that the closing the form can't be carried while processing the form. I tried
but that did not work.
I tested for the "BeforeUpdate" event, but that was not triggered since the "Activate" event appears to be the only event being triggered.
Two options seem to present themselves, one is to trap for this "error" on the Forms "OnError" event. The other would be to count the number of records remaining when the edit form is closed and if the record count is zero to close the PENDING PROJECTS form from the edit form rather than returning to the PENDING PROJECT form.
Any thoughts on the "best" way to do this?
When returning to the PENDING PROJECTS form, the activate event is triggered. However, I get the "Run time Error 2585" message that the closing the form can't be carried while processing the form. I tried
Code:
DoCmd.Close acForm, Me.Name, acSaveNo
I tested for the "BeforeUpdate" event, but that was not triggered since the "Activate" event appears to be the only event being triggered.
Two options seem to present themselves, one is to trap for this "error" on the Forms "OnError" event. The other would be to count the number of records remaining when the edit form is closed and if the record count is zero to close the PENDING PROJECTS form from the edit form rather than returning to the PENDING PROJECT form.
Any thoughts on the "best" way to do this?