Subform AllowAdditions, AllowDeletions not obeying property settings (1 Viewer)

Atomic Shrimp

Humanoid lifeform
Local time
Today, 04:43
Joined
Jun 16, 2000
Messages
1,954
I've got a datasheet subform on a tab page on a form. I don't want users to be able to add or delete records from the data, so I set both the AllowAdditions and AllowDeletions properties to 'No'

When I open the form and navigate to the tab where the datasheet subform appears, I *am* able to add and delete records.

I've checked my code and there's nothing in there I can see that could be setting it back to True, but when I debug.print the value of the subform's allowadditions and allowdeletions properties, they're 'True'

So I added a couple of lines in the form load event, explicitly setting the properties to False, which seemed to work, but one of my testers was still able to add and delete records.

What's going on here? What, besides an explicit assignment of the properties, can cause this behaviour in a subform that has (in design mode) the AllowAdditions and AllowDeletions properties set to 'No'?
 

missinglinq

AWF VIP
Local time
Yesterday, 23:43
Joined
Jun 20, 2003
Messages
6,423
What you really have to remember is that, in essence, a subform is not a form! It's based on a form, but it is, in fact, a control on a form. As such, it is controlled by the "Allow" properties of the form it resides on, just like any other control on the form.

To lock the subform, while allowing the main form to be edited/added to/deleted from, in Design View, select the subform control and got to Properties - Data and set the Locked Property to Yes. I think this will give you the result you're seeking.
 

Atomic Shrimp

Humanoid lifeform
Local time
Today, 04:43
Joined
Jun 16, 2000
Messages
1,954
I don't want to lock the form, I want to prevent the addition and deletion of records. (some fields in existing records are to be editable)

And I am accessing the subform's properties in the way you describe (I also tried opening it directly in its own design window)
 

Atomic Shrimp

Humanoid lifeform
Local time
Today, 04:43
Joined
Jun 16, 2000
Messages
1,954
I still couldn't get it to work properly - even if I changed the matching properties of the parent form to 'No' (as well as the subform), the subform still switches to permitting additions and deletions at run time.

I checked and double-checked my code and the properties aren't getting switched anywhere in there.

In the end, I have had to fix it by explicitly setting the AllowDeletions and AllowAdditions properties of the subform to False in the event that displays the tab where the subform is placed - this works, but I really don't like having to do that kind of workaround.
 

potato

New member
Local time
Yesterday, 20:43
Joined
Jan 7, 2013
Messages
2
I had to change AllowDeletions=false and AllowAdditions=false of the sub-form by code.

The funny thing is, that I have another sub-form on that form and there AllowDeletions and AllowAdditions are working without setting it by code to false
.
I couldn't find any differences between both sub-forms.

What's going on there???

====
I renamed the the 1st subform to the name of the 2nd and vice versa.
Now the former 1st subform appearing in the place where the 2nd subform was, has problems with AllowDeletions and AllowAdditions.
But the sub-form controls does not show AllowDeletions and AllowAdditions in the development environment.
=====
to be clear: There is the sub-form-element on the main page, but there are no properties for AllowDeletions and AllowAddions in the development view for the sub form element. But I can set these properties at the main form current and that works.
These Properties are set to NO in the subforms, but that works only if I call the subform directly without the main form.
I have a similar subform where delete an add are not allowed. If I use the rename tick, then it is obvious, that the settings of the sub-form-element, witch is the container for the subform on the main form is responsible for that effect.
But where are AllowDeletions and AllowAddions in the development view???

P.S. I'm working with Access 2002
 
Last edited:

Users who are viewing this thread

Top Bottom