One of the major issues with DoCmd.OpenForm is it doesn’t close the form before opening it again. This can lead to unexpected behavior of your application, so of course I created my own open form code:
Public Function OpenMyForm(strForm As String, Optional DataMode As AcFormOpenDataMode, Optional WindowMode As AcWindowMode, Optional strWhere As String, Optional strOpenArgs As String) As Boolean
DoCmd.Close acForm, strForm
DoCmd.OpenForm strForm, , strWhere, strWhere, DataMode, WindowMode, strOpenArgs
End Function
You will notice there are some missing arguments from my code, I just don’t use all of the arguments available to me when opening a form, (for example: the filter argument).
Enjoy
Juan
Deja tu comentario