G
Guest
I have a form with 2 levels of nested subforms. The main form is student. It
has a semester subform, which in turn has a courses subform. If the user goes
directly to the courses subform to create new semester courses but there is
no semester record created yet, I want to save the semester record with the
displayed default values from its subform. I put the following code in the
AfterUpdate event of the course field of the lowest level form.
Private Sub Course_AfterUpdate()
If Me.Parent.RecordsetClone.BOF Then
' save record in parent
Me.Parent.SaveSemRec.SetFocus
End If
End Sub
If this works, I can save the record in the GotFocus event of the SaveSemRec
control (which is enabled and visible but barely shows). But it doesn't get
to that point. The above code does not work. The message I get is error 2110
Can't move focus to control SaveSemRec. Why doesn't it work? Is it because
the parent is not the main form? Is there another way to get this to work?
has a semester subform, which in turn has a courses subform. If the user goes
directly to the courses subform to create new semester courses but there is
no semester record created yet, I want to save the semester record with the
displayed default values from its subform. I put the following code in the
AfterUpdate event of the course field of the lowest level form.
Private Sub Course_AfterUpdate()
If Me.Parent.RecordsetClone.BOF Then
' save record in parent
Me.Parent.SaveSemRec.SetFocus
End If
End Sub
If this works, I can save the record in the GotFocus event of the SaveSemRec
control (which is enabled and visible but barely shows). But it doesn't get
to that point. The above code does not work. The message I get is error 2110
Can't move focus to control SaveSemRec. Why doesn't it work? Is it because
the parent is not the main form? Is there another way to get this to work?