Solved Sub datasheet not allowing new records after setting no edit in main datasheet form

I am struggling to see the point of setting edits to no in design mode, only to unset them in form load?
Edit: ok, it seems that would allow just one record?
The form is to allow new entries only and no deletions or edits.
Sorry my msgs are overlapping.
Thanks guys for all your inputs.
 
@Gasman: Posts (my change and the new post) overlapped in time, so I still added the note in #14.
First I tested:
Code:
Private Sub Form_Load()
   Me.FRM_MESSAGES_RESPONSE_SENDER_MASTER_RESTRICTED.Form.AllowAdditions = True
End Sub
this has only effect for 1. record.
Yes, O/P discovered that. :)
Curious as to how it worked for @CJ_London
 
The subdatasheet is NOT a subform. It is using the properties of the parent form. If you want a subform, you need a real one.
In the example, a subform was explicitly set by the OP for this purpose.
What else but a subform should the subform control be in this example?
 
The OP uses a form with datasheet view in the subform control.
Curiously, the change to AllowAdditions=True in the UF only works for the 1st record in the main form. AllowEdits works for all displayed subform masks.

/edit:
However, this is only the case in the datasheet view. If you use the subform as a continuous form, AllowAdditions works for all of them.

Code:
Private Sub Form_Load()
   With Me.FRM_MESSAGES_RESPONSE_SENDER_MASTER_RESTRICTED.Form
      .AllowAdditions = True
   End With
End Sub
... this works only with continuous form, not with datasheet view.
If you press {F5} in the subform (without new record line) new records also allowed in the other records of main form.
 
Last edited:
Curious as to how it worked for @CJ_London
No idea, but since I couldn't replicate the issue, I didn't feel I could contribute anything meaningful
 
The form is to allow new entries only and no deletions or edits.
Sorry my msgs are overlapping.
Thanks guys for all your inputs.
Do set the form to Data Entry = yes?
 
#14 worked in my test:
design mode: AllowEdits = true,
change to AllowEdits = false via VBA
 
This thread is marked as solved but there is no comment regarding what the solution was. Can someone update it please.
I manually coded to lock the fields based on the id field. If it's a new record with no ID number then it enables the fields for inputs. I posted a sample db as well.
 
Could just use Me.NewRecord?
 

Users who are viewing this thread

Back
Top Bottom