Is there better code than this:

  • Thread starter Thread starter 1aae
  • Start date Start date
1

1aae

Thank you:

Is there better code than this:
DoCmd.OpenForm "form1", acDesign, , , , acDialog
' here some statments applay to form design
DoCmd.Close acForm, "Form1", acSaveYes
 
1aae said:
Thank you:

Is there better code than this:
DoCmd.OpenForm "form1", acDesign, , , , acDialog
' here some statments applay to form design
DoCmd.Close acForm, "Form1", acSaveYes

I guess that would depend on what you want to do. But I'm curious as to
what you intend by specifying acDialog for the WindowMode argument. If
it worked, opening the form in dialog mode would pause the code
execution in your routine until the form is closed again (or hidden).
In that case, your statements that follow the OpenForm wouldn't work,
because Form1 would be closed by the time they execute. However, my
quick test suggests that specifying the combination of View:=acDesign
and WindowMode:=acDialog *doesn't* work, and that what you get (in A2K2,
anyway) is a form opened in form view, not design view. The form
appears to be open in dialog mode, but I find that the statements
immediately following the OpenForm *are* executed. How odd.

Anyway, you may get what you want better by opening the form in design
view, but hidden:

DoCmd.OpenForm "Form1", acDesign, , , , acHidden
' ... statements modifying the design
DoCmd.Close acForm, "Form1", acSaveYes
 
Back
Top