N
Noise
I have a main form and a subform. The main form has all the data for
the parent record. The subform has all the data for the child
record(s). There can be many child records for a single parent record.
I want to always be able to add new parent records. Under given
circumstances I want to allow or restrict when child records can be
created. All that works OK.
My problem is when I am on a parent record where the child record is
not allowed to add new records. If I go to add a new Parent record,
then the child record's subform shows up as a big blank spot. I think
it's because at that time of creating the new parent record, the child
record had AllowAdditions = FALSE, so it won't allow it.
It works fine when I am at a parent record with a child record that
allows additions of new child records.
What I want to do is this: I want to be able to always create a new
parent/child record no matter what is the status of the current child
record.
I could set the subform's property to AllowAdditions = TRUE, but I
don't know where to put the code. I tried putting it on the subform,
but apparently got it wrong. I also tried to put it on the main form
but under which event?
What event will always capture the creation of a new record on the
parent form?
I thought about the CommandBeforeExecute event, but I cannot figure
out how to program it. I was thinking of the following, but don't know
what to do with it.
Private Sub Form_CommandBeforeExecute(ByVal Command As Variant, ByVal
Cancel As Object)
Forms![EnterData_MAIN]![EnterData_SUB].Form.AllowAdditions = True
End Sub
The MSDN technical information talks about it but doesn't tell me how
to actually DO it or where to PUT it or how to implement it.
Anyone have any ideas?
the parent record. The subform has all the data for the child
record(s). There can be many child records for a single parent record.
I want to always be able to add new parent records. Under given
circumstances I want to allow or restrict when child records can be
created. All that works OK.
My problem is when I am on a parent record where the child record is
not allowed to add new records. If I go to add a new Parent record,
then the child record's subform shows up as a big blank spot. I think
it's because at that time of creating the new parent record, the child
record had AllowAdditions = FALSE, so it won't allow it.
It works fine when I am at a parent record with a child record that
allows additions of new child records.
What I want to do is this: I want to be able to always create a new
parent/child record no matter what is the status of the current child
record.
I could set the subform's property to AllowAdditions = TRUE, but I
don't know where to put the code. I tried putting it on the subform,
but apparently got it wrong. I also tried to put it on the main form
but under which event?
What event will always capture the creation of a new record on the
parent form?
I thought about the CommandBeforeExecute event, but I cannot figure
out how to program it. I was thinking of the following, but don't know
what to do with it.
Private Sub Form_CommandBeforeExecute(ByVal Command As Variant, ByVal
Cancel As Object)
Forms![EnterData_MAIN]![EnterData_SUB].Form.AllowAdditions = True
End Sub
The MSDN technical information talks about it but doesn't tell me how
to actually DO it or where to PUT it or how to implement it.
Anyone have any ideas?