Problem opening subform

S

sue gray

I have a main form (frmTxPlanHxMH) that opens a subform (frmTxPlanMH) from a
command button. frmTxPlanMH contains 5 subforms laid out in pages. My
problem is that when I open frmTxPlanMH none of the 5 subforms are there. I
see the tabnames but not the fields on the forms. But when I close
frmTxPlanMH and then open it from another command button to open it in read
only the forms show up.

tblclient - pk - clientid
tbltxplanmh - pk txplanMHID
one to many - clientid from tblclient to clientid from tbltxplanmh

Here's the code for the command buttons. Thanks for any help it's greatly
appreciated.

Private Sub AddTxPlan_MH_Click()

On Error GoTo Err_AddTxPlan_MH_Click

Dim strDocName As String

strDocName = "frmTxPlanMH"

DoCmd.OpenForm strDocName, , , , acAdd, , Me!clientid

If IsNull(Forms!frmtxplanmh!clientid) Then
Forms!frmtxplanmh!clientid = Me!clientid
End If


Exit_AddTxPlan_MH_Click:
Exit Sub

Err_AddTxPlan_MH_Click:
MsgBox Err.Description
Resume Exit_AddTxPlan_MH_Click

End Sub


Private Sub View_TxPlan_MH_Click()
On Error GoTo Err_View_TxPlan_MH_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmTxPlanMh"

stLinkCriteria = "[txplanMHid]=" & Me![txplanMHID]
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormReadOnly

Exit_View_TxPlan_MH_Click:
Exit Sub

Err_View_TxPlan_MH_Click:
MsgBox Err.Description
Resume Exit_View_TxPlan_MH_Click

End Sub
 

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

Top