Open another subform from a subform



I have a main form that has a subform (continous form). Each line in the
subform has a button that opens the detailed information for the specific

Private Sub Kommandoknap49_Click()
On Error GoTo Err_Kommandoknap49_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frm03SubformProject01"

stLinkCriteria = "[ProjectID]=" & Me![PID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit Sub

MsgBox Err.Description
Resume Exit_Kommandoknap49_Click

End Sub

How can I force frm03SubformProject01 to open in the same control on my main
form? Like you see on websites using frames? As it is now, the detailed
subform opens on top of my main form. Thanks in advance!

Jon Lewis

If I understand your requirement correctly try having frm03SubformProject01
permanently open as the SourceObject to a subform control (e.g. sub2) the
same size and position on the main form as the one that hosts your
continuous form (sub1) but with the subform control's visible property set
to false.

Modify your Kommandoknap49_Click() sub to go to the correct record in
frm03SubformProject01, shift the focus to somewhere on your main form and
make sub1 invisible and sub2 visible. You'll need a button on
frm03SubformProject01 to reverse the visible properties when finished.


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question