Solved

Subform will not open within the main form

Posted on 2016-08-02
3
32 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
3 Comments
 
LVL 49

Accepted Solution

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

/gustav
0
 
LVL 34

Assisted Solution

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

Assisted Solution

by:Helen_Feddema
Helen_Feddema earned 125 total points
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now