Is there better code than this:

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
 
D

Dirk Goldgar

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top