how to do some action after EXIT a Command button

rickyfong

Registered User.
Local time
Yesterday, 23:52
Joined
Nov 25, 2010
Messages
199
Code:
Private Sub Command124_Click()

On Error GoTo Err_Command124_Click
   Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "PRINTSQUARE 1"
    DoCmd.OpenForm stDocName, 3, , , , 4
 
Exit_Command124_Click:
       Exit Sub
 
Err_Command124_Click:
    MsgBox Err.Description
    Resume Exit_Command124_Click
    
End Sub

An command button would open a form to display some query result, and how could I do something after user exit that form!! I have tried to put some action afater the Docmd and EXIT_COMMAND124_CLICK:, both didn't work!! Any idea?? Thanks a lot!!
 
If you add the acDialog constant to the window mode argument of OpenForm, code after that line will not run until the second form is closed or hidden.
 
Sorry!! I am not sure I got your meaning! Anyway, I have changed the statement to as follows but when I put statement such as MSGBOX "AFTER OPEN FORM" to test, the message appeared in the open form but not appeared after user closing the form!! Please help!! Thanks a lot!!

DoCmd.OpenForm stDocName, 3

Once again, my idea is to do some action such as updating something after user closing the form! Or is that MSGBOX is not a good tester!?? Thanks!!
 
Try this:

DoCmd.OpenForm "PRINTSQUARE 1", WindowMode:=acDialog
Msgbox "After the form is closed"

You should not see the message box until the form is closed (or hidden).
 

Users who are viewing this thread

Back
Top Bottom