Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Referencing Issues 1

Status
Not open for further replies.

Chunkus

Technical User
Jun 12, 2003
24
GB
Hi

I have two forms:

1. DataForm
In datasheet view.

2. UserFrom
The userform has no data directly on it. It has a Title, a button for closting the form. It will also have a button for filtering later on. Finally, it has the Dataform embedded in it.

I'm struggeling to write code for the filtering button on the Userform to filter the Dataform.

How you do reference the embedded form please? This is driving me mad!!!!! ( [Forms]![Mainform]![Subform].filter... )

Also, is there a better way? Originally, I had one form, set in Continuous form mode (with all the fields in a horizontal line). But I found the formatting looked better using the 2 forms (1 in datasheet view). Is this the better way of doing things?

Thank you to anybody taking time to try to resolve this for me.

Regards

Jason
 
How you do reference the embedded form
Forms!UserForm!DataForm.Form

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi

Thx For the reply. I'm Still struggeling though. :-(

The two forms are as follows:
UserForm=frmCmtsDetail
DataForm=frmCmtsDetailqry

I still cannot ref the dataform with this code:

Dim MyMainFrm As Form
Dim MySubFrm As Form
stDocName = "frmCmtsDetail"
DoCmd.OpenForm stDocName, acNormal, acReadOnly,

Set MyMainFrm = Forms!frmCmtsDetail [THIS IS OK]
Set MySubFrm = MyMainFrm!frmCmtsDetailQry [ERROR HERE]

Please, what am I doing wrong? I spent far too long on this on Friday. Would really appreciate some help!

Regards

Jason
 
[ERROR HERE]
Which error ?

what about this ?
Set MySubFrm = MyMainFrm!frmCmtsDetailQry.Form

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi

Thx for getting bk to me.

Run time 2465
Can't find the FIELD frmCmtsDetailQry referred to in your expression.

Arrrrrggghghhhhhhhh [mad]

Jason
 
You have to use the name of the CONTROL hosting your subform.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi

THANK YOU VERY MUCH!!!!!! [2thumbsup]

It worked:
Code:
 MySubFrm = MyMainFrm.Controls("ctrlCmtsDetail").Form

I've learnt a lot from this, and it will be VERY useful!!!

I'm happy now. [smile]


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top