subform syntax

  • Thread starter Thread starter smk23
  • Start date Start date
S

smk23

In the following code, I would like to set the sub form but get an
application error with the second line. frm, frmsub and strTab are all
declared prior to this. What is the correct syntax? Thanks so much!!

Set frm = Forms("frmBrMain2")

Set frmsub = frm.Forms("frm" & strTab).Form

Sam
 
hi Sam,
In the following code, I would like to set the sub form but get an
application error with the second line. frm, frmsub and strTab are all
declared prior to this. What is the correct syntax? Thanks so much!!

Set frm = Forms("frmBrMain2")

Set frmsub = frm.Forms("frm" & strTab).Form
This should work:

Dim frm As Access.Form
Dim frmSub As Access.Form

Set frm = Forms("frmBrMain2")
Set frmSub = frm!subFormControlName.Form

or

Set frmSub = frm.Controls("subFormControlName").Form

mfG
--> stefan <--
 
Back
Top