Changing the Pop up, Modal, and Allow Design Change properties

J

Jack Peyton

I use Access 2000. I have a DB that has 56 forms. I change the Pop up,
Modal, and Allow Design Change properties for 19 of the forms when I work on
the DB. I use a command button and the following code to open the forms and
change the properties. Is there a better or shorter way to do this?
Any help will be appreciated.
Jack Peyton

Dim A As Variant, B As Variant

If Me.Command11.Caption = "Set Forms to Pop Up and Modal" Then
Me.Command11.Caption = "Set Forms to No Pop Up and Modal"
A = True
B = False
ElseIf Me.Command11.Caption = "Set Forms to No Pop Up and Modal" Then
Me.Command11.Caption = "Set Forms to Pop Up and Modal"
A = False
B = True
End If
‘Sample of the code to open each form and change the properties. This is
repeated for each of the 19 forms.
DoCmd.OpenForm "FMisc", acDesign
Forms!FMisc.PopUp = A
Forms!FMisc.Modal = A
Forms!FMisc.AllowDesignChanges = B
DoCmd.Close acForm, "FMisc"
 
A

AccessVandal via AccessMonster.com

Jack,

You're a lucky guy. I was just creating a Function to set the default form
properties.
Look at it and edit if needed.

Function ChangeDefaultProperty(strFormName As String, IntPopup As Integer, _
IntModal As Integer, IntAllowDesign As Integer)

Dim frm As Form, pro As Property

On Error Resume Next
For Each frm In Forms
If frm.Name = strFormName Then
For Each pro In frm.Properties
If pro.Name = "PopUp" Then
pro.Value = IntPopup
End If
If pro.Name = "Modal" Then
pro.Value = IntModal
End If
If pro.Name = "AllowDesignChanges" Then
pro.Value = IntAllowDesign
End If
Next pro
DoCmd.Close acForm, strFormName, acSaveYes
End If
Next frm
'your error control here
End Function

In your control event,

DoCmd.OpenForm "frmSingleOrCont", acDesign ' open the form in design mode
Call ChangeDefaultProperty("YourFormName",-1,-1,-1)
 
J

Jack Peyton

Thanks for taking the time to look at this. I will try it out this morning.
Jack Peyton
 

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