subform syntax

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
 
S

Stefan Hoffmann

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 <--
 
Top