Why I can't edit data in a sub form?

deletedT

Guest
Local time
Today, 18:50
Joined
Feb 2, 2019
Messages
1,218
I'm just experimenting. It's not a real database.

Problem: If I open a form, the data in its sub form is locked and I'm not able to edit it.

What I've done so far:
I've changed AllowEdits of sub form to true. No effect.
If I open the sub form on its own, I'm able to edit the data. But not when it's embedded.
If I open the form with the following code, I'm able to edit the data in sub form. But double clicking the form in navigation pane and opening it, locks the data in sub from.
Code:
    DoCmd.OpenForm "frmOrders"
    Forms("frmOrders")!frmProcesses_Receiption.Form.AllowEdits = True
No code is executed in on open or on load events.

Main form's record source is a query with inner joint.
Sub form's record source is a table.
The database is attached.

What am I doing wrong here.

If you want to test:
Open the database. Double click and open frmOrders form. You'll see the data in sub form is locked.
Run the code in test2() in module1. You'll see the data is editable.

Thanks for your help.
 

Attachments

Last edited:
Main form has AllowAdditions and AllowEdits set to No. This locks every object on that form, including subform container. However, record deletion is allowed because AllowDeletions is set to Yes.

VBA overrides these design settings.
 
Main form has AllowAdditions and AllowEdits set to No. This locks every object on that form, including subform container. However, record deletion is allowed because AllowDeletions is set to Yes.

Never thought of that.
Thanks.
I've tried to add some reputation several times, but I receive a message that I have to spread first.
I hope there was a way....

thanks again.
 
Main form has AllowAdditions and AllowEdits set to No. This locks every object on that form, including subform container.

What about if I want to prevent editing data of a form but allow editing its sub form?
 
Then set each control (except the subform container) on main form as Locked and TabStop No instead of using form properties.
 

Users who are viewing this thread

Back
Top Bottom