Forum Discussion
split form inside a form
maybe I didn't explain clearly . I want to Display a form and its datasheet " like a split form" but me I dont want a split form I want to create a form and its datasheet .
Let me see if I can understand the situation a bit better.
You have a main form bound to this query. You also have a SUBform bound to the same query.
You want to show the main form in Single Form View. You want to show the SUBform in Datasheet View.
This is, in fact, a lot like a Split Form would work, is it not? There are some limitations to Split Forms that might make this approach more desirable.
That said, I am not convinced this is such a good idea, so I'm going to offer an alternative and see what you think.
If the point is to use the SUBform to navigate the main form, then a List Box control bound to that same query would do the job and be considerably less work to implement.
If there is another reason to want to have both forms, perhaps you can explain that so I can better understand how it needs to work.
As it is, I can see simply placing the following code (or something similar to it), in the Current Event of the SUBform. I'm not sure I've ever seen this done, so it's sort of a guess about how it ought to work, though.
Private Sub Form_Current()
Dim lngPrimaryKey as Long
Dim rstParentFormRecordSource as DAO.Recordset
lngPrimaryKey = Me.PrimaryKey
Set rstParentFormRecordSource = Me.Parent.Form.RecordsetClone
rstParentFormRecordSource .FindFirst "PrimaryKey = " & lngPrimaryKey
Me.Parent.Recordsource.Bookmark = rstParentFormRecordSource.Bookmark
Set rstParentFormRecordSource = Nothing
End Sub
Thanks for further clarifying the goal.