Solved

Subform will not open within the main form

Posted on 2016-08-02
3
57 Views
Last Modified: 2016-08-03
I have two sub-forms on a main form.   The 2nd subform is set to visible = false when the main form opens.  But on 1st subform, when the user clicks a command button in the 1st subform I want the 2nd subform to become visible within the main form.  But with the onclick code I have currently the 2nd subform, named "subfrmSearchContractsDS",  is opening outside the main form and I cannot figure out why.

Here is my onclick code:

    Dim strWhereCondition As String

    'several lines of code here for the strWhereCondition

    DoCmd.OpenForm "subfrmSearchContractsDS", acFormDS, , strWhereCondition, acFormReadOnly, acHidden
    
    Forms!subfrmSearchContractsDS.Visible = True

Open in new window

0
Comment
Question by:SteveL13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 50

Accepted Solution

by:
Gustav Brock earned 250 total points
ID: 41739227
Don't call DoCmd.OpenForm.
Only make the subform Visible.

/gustav
0
 
LVL 36

Assisted Solution

by:PatHartman
PatHartman earned 125 total points
ID: 41739245
Me.subfrmSearchContractsDS.Visible = True
0
 
LVL 31

Assisted Solution

by:Helen_Feddema
Helen_Feddema earned 125 total points
ID: 41739424
Make sure that you use the name of the Subform control in the line that makes it visible, not the form name itself (they should be different).  For example, the subform might be named fsubSelectedData and the Subform control name subSelectedData.  Also, you might want to place the button to make the 2nd subform visible on the main form, at least if you ever want to see it when the 1st subform is invisible.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question