Thanks for your help. As you will have gathered, my knowledge if Access
programming is limited, although I have always got there in the end with a
combination of trial and error and asking advice.
I have a structure in the back end of one parent, three child, and one of
the 'children' having a grandchild. They are linked by field
EnvelopeNumber.
I have tried an alternative approach of putting code in the command
buttons
opening the form and the following seems to work:
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "CapitalSubForm"
stLinkCriteria = "[EnvelopeNumber]=" & Me![EnvelopeNumber]
DoCmd.OpenForm stDocName, , , stLinkCriteria
If Forms!CAPITALSUBFORM.EnvelopeNumber = 0 Then
Forms!CAPITALSUBFORM.EnvelopeNumber = Me.EnvelopeNumber
Else: GoTo Capform
End If
Forms!CAPITALSUBFORM.ShareClass = "ORD"
Forms!CAPITALSUBFORM.ShareValue = "1"
Forms!CAPITALSUBFORM.PaidPerShare = "1"
Forms!CAPITALSUBFORM.Particulars = "Standard"
DoCmd.GoToRecord , , acNext
DoCmd.GoToRecord , , acPrevious
Capform:
DoCmd.Close acForm, "CapitalSubForm"
Does this seem OK?
Thanks
Dudley
Jeff Boyce said:
Dudley
I was referring to the parent and grandparent records, not the sub-form
and
form within which your sub-sub-form was embedded.
But perhaps I've assumed (?in error) that your use of main
form/sub-form/sub-sub-form reflects an underlying
grandparent/parent/child
relationship among the tables behind your forms...
Regards
Jeff Boyce
Microsoft Access MVP
The form is only opened by command buttons from other forms with code;
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Capital"
stLinkCriteria = "[EnvelopeNumber]=" & Me![EnvelopeNumber]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Thanks
Dudley
:
If a new sub-sub-form record is created, how is Access supposed to
know
who
its "parent" and "grand-parent" is?
Regards
Jeff Boyce
Microsoft Access MVP
When I open a form with a sub-sub-form, I have code 'On Open' to go
to
the
sub-sub-form:
Me.Capital_Subform.Form![SubscriberSubform].SetFocus
This works, but the user then creates a record in the sub-sub-form
but
not
in the subform, so I would also like the code to create and save a
record
in
the subform (if one does not already exist) with default data, and I
have
not
been able to work out how to do this. Can anyone advise?
Thanks
Dudley