Hi,
Please see attached database.
There is a one to many relationship between t_Main and t_Sub.
A bound textbox on f_t_Main contains a number which is the total number of subform records there are allowed to be.
So, I am thinking that I would need some VBA Code such as:
I am calling this in the On Current Event of the Main Form, as well as the Subform On Current Event, and I am also calling it in the AfterDeleteConfirm, and AfterInsert.
When trying to create a new record I get: Runtime Error 2465 Application-Defined or Object-Defined error and the above code line is highlighted
Also, I get a runtime error 2452 "the expression you entered has an invalid reference to the parent property"
If someone could please help with this I am trying to bake a cake based on some internet recipes and clearly I do not know how to fix this.........
Thank you for any help !!!!!!!!!!!
Please see attached database.
There is a one to many relationship between t_Main and t_Sub.
A bound textbox on f_t_Main contains a number which is the total number of subform records there are allowed to be.
So, I am thinking that I would need some VBA Code such as:
Code:
Private Sub AllowedSubformRecords()
Dim rst As Object
Set rst = Me.RecordsetClone
If rst.RecordCount >= Me.Parent.Controls_("Main_Form_Number") Then
Me.AllowAdditions = False
Else
Me.AllowAdditions = True
End If
End SubEnd Sub
I am calling this in the On Current Event of the Main Form, as well as the Subform On Current Event, and I am also calling it in the AfterDeleteConfirm, and AfterInsert.
Code:
If rst.RecordCount >= Me.Parent.Controls_("Main_Form_Number") Then
When trying to create a new record I get: Runtime Error 2465 Application-Defined or Object-Defined error and the above code line is highlighted
Also, I get a runtime error 2452 "the expression you entered has an invalid reference to the parent property"
If someone could please help with this I am trying to bake a cake based on some internet recipes and clearly I do not know how to fix this.........

Thank you for any help !!!!!!!!!!!