Changing the "AllowAdditions" property in Visual Basic

Help.Chris

Registered User.
Local time
Today, 14:10
Joined
Oct 11, 2000
Messages
43
Does anyone know how you can change the "AllowAdditions" property of a whole form at run time in Visual Basic.

Thanks for any help given.

Chris
 
Simply use the following VBA construct:

[form_name].AllowAdditions = [boolean expression]

I've developed the following Sub to set all the Allow... properties of a form to make it either read-only or read-write; I call it in each form's Activate procedure, using Me as the Frm argument, and an appropriate Boolean expression as the ReadWrite argument. The Dirty property is also set to false in every case, because if the current record has been modified (say, by the action of another form) it will become read-write despite the settings of the Allow... properties, which the Dirty property seems to override. Hope this helps.

Sub SecureForm(Frm As Form, ReadWrite As Boolean)
'resets form Frm's read-only/read-write status according to value of ReadWrite; also
'sets Frm's Dirty property to False to avoid having it override the other three properties
Frm.AllowAdditions = ReadWrite
Frm.AllowDeletions = ReadWrite
Frm.AllowEdits = ReadWrite
Frm.Dirty = False
End Sub
 

Users who are viewing this thread

Back
Top Bottom