472,119 Members | 992 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

Form will not Restrict Edits

Hi I have a Form with 4 sub forms (I know that is a lot) and I've noted that even though I have put, on many events, code to stop Edits, Additions, and Deletions. Allow Edits=False Allow Additions=False Allow Deletions=False It still Allows Edits?
At least 3 times in various events, I have put this code, yet once I change the Record, forward or backward, it suddenly Allows Edits??
When I check with the Debug.Print it says Allow Edits is False, yet it Allows Edits. I immediately open the form in Design mode and everything is set to False as it should be but it Allows Edits? Ihave compacted and repaired the db multiple times as well.

Anybody have any idea what the issue could be??
Jun 5 '20 #1
9 1389
twinnyfo
3,653 Expert Mod 2GB
RIchardCK,

Welcome to Bytes!

Initially, it seems like you have everything set correctly. However, this is puzzling:
even though I have put, on many events, code to stop Edits, Additions, and Deletions
Why are you adding code to stop editing if the sub-forms already should have that property established?

Additionally, you can also Lock the Sub-Forms, so that users cannot edit them. This is done in design view for the main form.

Furthermore, if you want to go to this step (which I often do with forms that I only want to display data), you can lock the individual controls on each sub-form. This prevents anyone from making any accidental/intentional changes.

Hope this hepps!
Jun 5 '20 #2
Hi I haven't actually gotten to testing the Subforms to see if the issue is there as well, this is on the Main Forms that I am having the problem. I have only once ever locked controls which is a bit of a pain when you want to do that because you have to unlock specific types after but bottom line this may work but certainly seems like a roundabout way to get to a Normal situation. I have been doing this for a long time (30 years) and I have never seen this before
Jun 5 '20 #3
Oh and these are Data Entry Forms that allow for review as people can make mistakes and the Team lead must be able to correct them. I open the forms in Read Only Mode then it changes to Allow Edits on its own when I change records, so weird.
Jun 5 '20 #4
twinnyfo
3,653 Expert Mod 2GB
So, your last post has just thoroughly confused me more than what I was before.

What exactly is the issue?

You mention your main form with four sub-forms (which really is not a lot, if you ask me), and then mention the inability to lock data. Which data? Data on the main form? or the sub-forms? If you lock down the main form, you may still be able to edit data in the sub-forms--and vice versa.

This is why I mentioned the properties of the sub-forms, as this is what I thought you had problems with. The properties are independent in many cases.
Jun 5 '20 #5
Hi T, sorry I should have been more clear. 1) my problem starts with the Main form, I hadn't even checked the subforms because I was so stunned with the error I was having on the Main. It was not to Lock the Data perse but to Lock the Form to Disallow Edits, Additions, or Deletions on the main form. I had put code in On Load, On Open of the form then on the control that got the first Focus Got Focus, and all the codes said Allow-Edits, Additions, Deletions=False and it was fine when the Form first opened, yet once I changed the record I was looking back (Next or Previous) I could easily edit anything on the main, which was stunning. Hope I have explained it better this time
Jun 5 '20 #6
Hi T I believe I just found the error, I think you will like this one. It seems that when I trap the Err.Number = -2147352567 and let it slip by w/o generating a popup it switches the ALlowEdits to True, but if I allow the popup nothing changes, so bizarre. I will continue on this but I just found it by accident.(only way to find something weird like this)
Jun 5 '20 #7
twinnyfo
3,653 Expert Mod 2GB
This is kind of an aside, here, but do you know what is causing that error to be thrown? Sometimes I can't prevent certain errors, so I trap specific ones, like you have. But, I much prefer to prevent them in the first place.

At least you have an explanation for your problem!
Jun 5 '20 #8
Hi T, yes it is because I have a Sum field on the main form taking values from the sub forms (weight totals from a hidden Running subtotal on each sub form, I then feed hat value to a control bound to a field n the record set. Sometimes the hidden fields do not have time to actually appear on the form so it counts it as an "invalid value" but there is no value because the hidden control has not yet appeared or taken the values from the her subforms. Hmm I see where you are going with this I will check the time of events for when the controls appear, d which events fire after e controls appear and maybe that will help. MY other fix seems to have t worked properly either there is a way round it and I am sure the users will d it. :)) You know how Users can be :))
Jun 5 '20 #9
NeoPa
32,497 Expert Mod 16PB
I don't know if this will help but I had something a little similar myself recently when I was setting editability (AllowEdits) for a subform within the Form used in the subform. I too noticed that when this was run on opening of the Form it often crashed. I bodged it with an error handler but I then realised that if I triggered the change of setting in the OnCurrent event of the main form it worked reliably.

It also gets set in the OnCurrent of the subform but the parent form setting ensures it's set correctly before moving between records in the subform.
Jun 5 '20 #10

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Bob Alston | last post: by
2 posts views Thread by Matt | last post: by
8 posts views Thread by bruno_guedesav | last post: by
scubak1w1
3 posts views Thread by scubak1w1 | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.