Subform in a tab control not allowing any editing (1 Viewer)

Coxylaad

New member
Local time
Today, 21:42
Joined
Jan 11, 2022
Messages
21
Hi all,
I've done a lot of searching on this and cannot find the answer

I have form that contains a tab control. on that tab control I have a subform.

I simply cannot get that subform to allow any input at all. I have a set of unbound text fields at the top of the subform that i use for filtering, and I cant even type in those.

When I open the subform on its own (ie not as a subform) it all works fine.

All the features of allow edits etc are set to yes. Im at a loss as to why the tab control is making everything read only.

Any ideas?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:42
Joined
May 7, 2009
Messages
19,169
check your Mainform's:

Allow Additions should be set to Yes
Allow Edits should be set to Yes.
 

SHANEMAC51

Active member
Local time
Tomorrow, 00:42
Joined
Jan 28, 2022
Messages
310
I simply cannot get that subform to allow any input at all. I have a set of unbound text fields at the top of the subform that i use for filtering, and I cant even type in those.

When I open the subform on its own (ie not as a subform) it all works fine.
maybe at the same time the subordinate form opens only for reading
 

Coxylaad

New member
Local time
Today, 21:42
Joined
Jan 11, 2022
Messages
21
yep, I change the parent forms allowedits attribute to ye and it works.

Problem is i dont want to allow edits on the parent form. I have an 'Allow Edits' button on the parent form that changed the allowedits attribute to the yes in the VBA code, but that doesnt seem to have an effect on the subform.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:42
Joined
May 7, 2009
Messages
19,169
what you need is a code that will Lock all your controls on the main form (load event).
and your button, that will Unlocked the controls.
 

Coxylaad

New member
Local time
Today, 21:42
Joined
Jan 11, 2022
Messages
21
yes, sorted. so the parent forms allowedits property is set to true, then when i load the foam I set it to false in VBA, and the subforms work.

Thanks everyone!
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 17:42
Joined
Feb 19, 2002
Messages
42,976
If you need AllowEdits to be Yes to allow you to use unbound search fields and combos, you can still very easily prevent changes to the form. You just have to use the BeforeUpdate event. Once you understand how Access events work, you have complete control over whether or not a record gets saved. Think of the beforeUpdate event as the flapper at the end of a funnel. If the flapper is closed, the record cannot b saved. If the flapper is open, the record can be saved - assuming it gets past the database RI also:)

So, in the form's BeforeUpdate event,

Me.Undo
Cancel = True

will silently prevent changed data from being saved. I would tend to give the user a message that the change is being discarded but that's just me.

If you want to control updates using security levels, this is the event where you would do it. You don't need to check first and lock the form, you just prevent the save if the user isn't authorized. NOTHING gets past the form's BeforeUpdate event no matter what prompted the save process to start.
 

Coxylaad

New member
Local time
Today, 21:42
Joined
Jan 11, 2022
Messages
21
Thanks for all your help, I understand how the beforeupdate works, although I never considered a practical use for it!

much appreciated - what a nice place this is!
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 17:42
Joined
Feb 19, 2002
Messages
42,976
I understand how the beforeupdate works, although I never considered a practical use for it!
It is only the heart and soul of bound forms. There is no other more important event. THIS is the event that prevents bad data from being saved if you bother with validation.

Welcome aboard:)
 

Users who are viewing this thread

Top Bottom