Code to change form properties

Roly Reefer

Registered User.
Local time
Today, 20:00
Joined
Jan 28, 2005
Messages
37
Hi,

I am learning vba and have some code to change to change the allow additions / allow deletions properties on a form, but can't get it to change the properties on the form (which i have set to no for both on the form - hoping to get them to change to yes, so i can then change other properties with code).

Private Sub Form_Load()

strFormAdd = Me.AllowAdditions
strFormDel = Me.AllowDeletions

End Sub

I have tried it in a few other form_ places but it still doesn't work. Please can somebody give me the right code to make this work and area to put it.

Thanks very much,

Roly
 
You must open the form in design view to change any of the properties. Why are you wanting to change the properties at run time? Perhaps you should look at your design scheme. Needing to change a form's properties at run time is unusual.
 
I just thought you would be able to change them in vba as well as design view. I wont try again.

Thanks for letting me know you can't do it.

What do you use the form.allowadditions for?
 
You can change it in VBA if you wanted to, but c smithwick's advice was that you should avoid doing that. He must have his reasons.

In my opinion I don't see why you wouldn't if you don't want users adding a new record as it locks your controls and its underlying record source.
 
Usually you only need to adjust those properties if the user is limited to their options based on their security or user level then you might want to prevent a user from deleting or adding records

Me.AllowAdditions = False
Me.AllowDeletions = False
 

Users who are viewing this thread

Back
Top Bottom