Solved

Subform will not open within the main form

Posted on 2016-08-02
3
45 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
ID: 41739227
Don't call DoCmd.OpenForm.
Only make the subform Visible.

/gustav
0
 
LVL 35

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

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…
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…
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.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

785 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