Preventing Add/Delete on Subform (1 Viewer)

MBruns

New member
Local time
Today, 08:03
Joined
Feb 6, 2004
Messages
8
I've got a subform that I want to keep people from editing while allowing them to view all the data that's on there. Based on who they are and whether they should be able to edit or not I lock them out of editing the main form and various controls on the subform. I have code that theoretically locks the subform, but as far as I can tell it doesn't do anything.

The controls on the subform get locked by code like:

Forms!frmInputMainByEntry.Form!FrmSubInputDetail!Hours.Locked = True

This works for keeping users from editing the individual fields, but not from adding or deleting records from the subform. The subform doesn't seem to have the same allowadditions property the main form does. I can set the enable property to no for the subform, but then people can't scroll to the bottom of the subform entries.

Any ideas?

Thanks,

Mike Bruns
 

jfgambit

Kinetic Card Dealer
Local time
Today, 08:03
Joined
Jul 18, 2002
Messages
798
In the Properties of the form set the Allow Additions and Allow Deletions to "NO"

HTH
 

MBruns

New member
Local time
Today, 08:03
Joined
Feb 6, 2004
Messages
8
Is there a way to do this just for the subform

jfgambit said:
In the Properties of the form set the Allow Additions and Allow Deletions to "NO"

HTH
I know I can do it on the main form properties, but what about the subform....Thanks
 

Mile-O

Back once again...
Local time
Today, 08:03
Joined
Dec 10, 2002
Messages
11,316
MBruns said:
I know I can do it on the main form properties, but what about the subform

A subform is just the same as any form. In fact it is a form. It's just embedded within a form. They both have the same properties throughout.
 

MBruns

New member
Local time
Today, 08:03
Joined
Feb 6, 2004
Messages
8
Am I missing something

Mile-O-Phile said:
A subform is just the same as any form. In fact it is a form. It's just embedded within a form. They both have the same properties throughout.

When I click on the subform I get two sets of things. Single click I get onEnter and OnExit events. Click again, I get a list like a regular form. However when I try to refer to the subforms' "AllowDeletions/Additions" properties I get an error message saying the object I'm referring to doesn't support those properties.

Does anyone have a basic syntax to refer to the subform Allow deletions properties from a main form event example?

It seems like this should be simple, but it's not. I have no problem referring to individual controls and locking them on the subform, but referencing the subforms allow additions and allow deletions has me baffled.
 

MBruns

New member
Local time
Today, 08:03
Joined
Feb 6, 2004
Messages
8
Here's my answer

So here's the answer I found. Yes, it's true that subforms have the same properties, I just couldn't get the syntax to refer to them right. Here's an example:

Forms!frmInputMainbyEntry.Form!FrmSubInputDetail.Form.AllowDeletions = False

This does the trick.
 

kons21

New member
Local time
Today, 03:03
Joined
Dec 2, 2019
Messages
1
I have a similar issue, bit a bit more specific.

I have the "additions/deletions" set to "no." When the form loads initially the user cannot add or delete records.

However....

I also want the user to be able to sort/filter the subform. I am using "Browse to" function to do that. After I use the "browse to" function the "New Record" line shows up again, and the user is able to again try to add new records or delete records.

Does anyone know a workaround this?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:03
Joined
Oct 29, 2018
Messages
21,471
I have a similar issue, bit a bit more specific.

I have the "additions/deletions" set to "no." When the form loads initially the user cannot add or delete records.

However....

I also want the user to be able to sort/filter the subform. I am using "Browse to" function to do that. After I use the "browse to" function the "New Record" line shows up again, and the user is able to again try to add new records or delete records.

Does anyone know a workaround this?
Hi. Welcome to AWF! Recommend starting your own thread, since this is a 15-year old thread.
 

Users who are viewing this thread

Top Bottom