By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,745 Members | 1,957 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,745 IT Pros & Developers. It's quick & easy.

Loop through all forms to set Allow Design Changes Property

P: n/a
AP
I personally cannot stand the Allow Design Changes property set to
anything other than design view. Is there a way to loop through all
forms and set this property to design view only? There always seem to
be a few forms that slip past and I figured this would be a good way to
make sure they were all changed.
Thanks

Nov 13 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
On 15 Jun 2005 07:39:29 -0700, "AP" <ap******@thompsongroup.com> wrote:
I personally cannot stand the Allow Design Changes property set to
anything other than design view. Is there a way to loop through all
forms and set this property to design view only? There always seem to
be a few forms that slip past and I figured this would be a good way to
make sure they were all changed.
Thanks


Yes there is. I don't have any code in front of me to remember the exact
statements required, but in general...

- Create an object variable called objForm of type AccessObject, and use it in
a For Each loop over CurrentProject.AllForms.

- Inside this loop, use objForm.Name to determine the form name, open the form
in design view, use Forms(objForm.Name) to reference the open form, and set
the property, then close the form using the option to save changes.

Before running this code, make sure no forms are open.
Nov 13 '05 #2

P: n/a
jv
if you are using ADP, here's the code that I used:

Public Sub UpdateForms()
On Error Resume Next
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentProject
'Search for open AccessObject objects in AllForms collection.
For Each obj In dbs.AllForms
DoCmd.OpenForm obj.Name, acDesign
If Forms(obj.Name).AllowDesignChanges = True Then
Debug.Print "Updating AllowDesignChanges for " & obj.Name
Forms(obj.Name).AllowDesignChanges = False
End If
DoCmd.Close acForm, obj.Name, acSaveYes
Next obj
End Sub

Nov 13 '05 #3

P: n/a
On 15 Jun 2005 08:45:55 -0700, "jv" <ju***********@hotmail.com> wrote:
if you are using ADP, here's the code that I used:

Public Sub UpdateForms()
On Error Resume Next
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentProject
'Search for open AccessObject objects in AllForms collection.
For Each obj In dbs.AllForms
DoCmd.OpenForm obj.Name, acDesign
If Forms(obj.Name).AllowDesignChanges = True Then
Debug.Print "Updating AllowDesignChanges for " & obj.Name
Forms(obj.Name).AllowDesignChanges = False
End If
DoCmd.Close acForm, obj.Name, acSaveYes
Next obj
End Sub


That code should work fine in either an ADP or an MDB, FWICS.
Nov 13 '05 #4

P: n/a
Steve Jorgensen <no****@nospam.nospam> wrote in
news:d6********************************@4ax.com:
On 15 Jun 2005 07:39:29 -0700, "AP" <ap******@thompsongroup.com>
wrote:
I personally cannot stand the Allow Design Changes property set to
anything other than design view. Is there a way to loop through
all forms and set this property to design view only? There always
seem to be a few forms that slip past and I figured this would be
a good way to make sure they were all changed.
Thanks
Yes there is. I don't have any code in front of me to remember
the exact statements required, but in general...

- Create an object variable called objForm of type AccessObject,
and use it in a For Each loop over CurrentProject.AllForms.


If you're in A97, which didn't have that collection:

CurrentDB.Containers("Forms").Documents
- Inside this loop, use objForm.Name to determine the form name,
open the form in design view, use Forms(objForm.Name) to reference
the open form, and set the property, then close the form using the
option to save changes.

Before running this code, make sure no forms are open.


Here's the A97 code:

Public Sub turnOffFormProps()
Dim strForm As String, db As DAO.Database
Dim doc As DAO.Document
Set db = CurrentDb

For Each doc In db.Containers("Forms").Documents
strForm = doc.Name
DoCmd.OpenForm strForm, acDesign
Debug.Print Forms(strForm).Properties("AllowDesignChanges")
Forms(strForm).Properties("AllowDesignChanges") = False
DoCmd.Close acForm, strForm, acSaveYes
Next doc

Set doc = Nothing
db.Close
Set db = Nothing
End Sub

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #5

P: n/a
Steve Jorgensen <no****@nospam.nospam> wrote in
news:d6********************************@4ax.com:
On 15 Jun 2005 07:39:29 -0700, "AP" <ap******@thompsongroup.com>
wrote:
I personally cannot stand the Allow Design Changes property set to
anything other than design view. Is there a way to loop through
all forms and set this property to design view only? There always
seem to be a few forms that slip past and I figured this would be
a good way to make sure they were all changed.
Thanks


Yes there is. I don't have any code in front of me to remember
the exact statements required, but in general...

- Create an object variable called objForm of type AccessObject,
and use it in a For Each loop over CurrentProject.AllForms.

- Inside this loop, use objForm.Name to determine the form name,
open the form in design view, use Forms(objForm.Name) to reference
the open form, and set the property, then close the form using the
option to save changes.

Before running this code, make sure no forms are open.


Silly me. You don't need to run the code in A97.

DBs converted from A97 either don't have the property or set it to
False, which is one reason why it was ages before I ever even knew
this "feature" existed (and, yes, I mean to ridicule the
introduction of what looks to me like a completely useless feature).

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #6

P: n/a

"David W. Fenton" <dX********@bway.net.invalid> schreef in bericht news:Xn**********************************@24.168.1 28.74...

Silly me. You don't need to run the code in A97.


David, did you have your brains dilated today? ;-)

Seriously, I have not noticed the property until this very moment ...
Anyone using it? When?

So we might need:
'GetRidOfAutoCorrect' (you provided code with this name IIRC)
'GetRidOfSubDataSheets'
'GetRidOfSomeProps'

Arno R
Nov 13 '05 #7

P: n/a
"Arno R" <ar***********@tiscali.nl> wrote in
news:42*********************@dreader2.news.tiscali .nl:
"David W. Fenton" <dX********@bway.net.invalid> schreef in bericht
news:Xn**********************************@24.168.1 28.74...

Silly me. You don't need to run the code in A97.


David, did you have your brains dilated today? ;-)

Seriously, I have not noticed the property until this very moment
... Anyone using it? When?

So we might need:
'GetRidOfAutoCorrect' (you provided code with this name
IIRC)
'GetRidOfSubDataSheets'
'GetRidOfSomeProps'


Well, I've got code for the first two, plus what I just posted to
get rid of the stupid property that causes property sheets to end up
displayed when you forget to close the property sheet during
development.

That seems like the kind of thing that is going to trip up the
novice more often than the professional, but it's something that
would help only the pro if it had any use at all, so it just seems
like a very dumb feature.

The on thing I *really* wish I could turn off is displaying the
subforms in place! What a colossally stupid feature!

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #8

P: n/a
> The on thing I *really* wish I could turn off is displaying the
subforms in place! What a colossally stupid feature!

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc


Michka has a 'solution' (well, it helps...) for that, you know the "TSI Subforminator" I guess?

Also what I do sometimes is:
- Open the subform(s) in design view first, before opening the main form.

Arno R
Nov 13 '05 #9

P: n/a
"Arno R" <ar***********@tiscali.nl> wrote in
news:42*********************@dreader2.news.tiscali .nl:
The on thing I *really* wish I could turn off is displaying the
subforms in place! What a colossally stupid feature!

--
David W. Fenton
http://www.bway.net/~dfenton dfenton at bway dot net
http://www.bway.net/~dfassoc
Michka has a 'solution' (well, it helps...) for that, you know the
"TSI Subforminator" I guess?


I haven't done enough A2K development to download it, but, yes, I
did know about it.
Also what I do sometimes is:
- Open the subform(s) in design view first, before opening the
main form.


That's how I always work.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.