It works great. Thanks, Marsh.
However, in order to get it to not crash on the
Debug.Print frm.Name
statement with an "Object variable or With block variable not set" error, I
had to add the
For Each frm in Forms
. . .
Next frm"
statements. With those back in, it didn't produce an error message, and it
saved the modified Modal property in all forms.
Is there a line of code I can use to set the frm object variable to the form
that's currently opened in Design View without running through the For Each
loop? I know the loop is overkill, but I don't know how to set the object
variable otherwise.
Thanks again in advance,
Paul
>>I'm trying to use the code below to set the Modal property of all forms in
>>an Access 2002 database to "No."
[quoted text clipped - 51 lines]
> DoCmd.Close acForm, strFormName, acSaveYes
> Next frmDoc
TC - 08 Apr 2006 02:09 GMT
dim frm as form
docmd.openform "blah", ... acDesign ...
set frm = forms("blah")
HTH,
TC (MVP Access)
http://tc2.atspace.com
Marshall Barton - 08 Apr 2006 04:23 GMT
Sorry, I wasn't paying any attention to the Debug lines.
You really do not want to loop through all open forms just
to provide an object reference. you can do what TC
suggested,
or use:
With Forms(strFormName)
.Modal = False
Debug.Print .Name
Debug.Print .Modal
End With
or change the debug lines to:
Debug.Print Forms(strFormName).Name
Debug.Print Forms(strFormName).Modal
Personally, I prefer usinf With.

Signature
Marsh
MVP [MS Access]
>It works great. Thanks, Marsh.
>
[quoted text clipped - 72 lines]
>> DoCmd.Close acForm, strFormName, acSaveYes
>> Next frmDoc
Paul Ponzelli - 08 Apr 2006 21:10 GMT
Thanks for the array of choices, gentlemen. The all work just fine.
I was confused about the right syntax for setting object variables, but your
examples shed some light on this for me.
Paul