?
Solved

Open subform based on current record

Posted on 2012-12-27
2
Medium Priority
?
724 Views
Last Modified: 2012-12-27
Morning Everyone,

Can someone offer some guidance here?

I have a primary form and a subform already created.  I want to place a command button into the detail of the primary form to open a subfrom based on the current record.

I assume I am going to use the Open Form method to accomplish this, however I am having difficulty understanding how to create the WHERE statement.

Both forms are based on primary keys using the same data "Item_Nr".

Form One details "item_Nr" and other information based on header selection

Form two details "Item_Nr" and other information based on a query from numerous tables.

Thanks for any help offered!

MC
0
Comment
Question by:MCaliebe
[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
2 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 1000 total points
ID: 38724011
By 'subform' do you mean a true subform which is embedded in your main form? or is it a separate popup form?

If it is the latter, you would use code similar to this from Form 1:

Docmd.OpenForm "Form 2", WhereCondition := "Item_Nr = " & Me.[Item_Nr]

Open in new window


That assumes that Item_Nr is numeric.  If it is text, the code would be:

Docmd.OpenForm "Form 2", WhereCondition := "Item_Nr = '" & Me.[Item_Nr] & "'"

Open in new window

0
 

Author Closing Comment

by:MCaliebe
ID: 38724086
It was indeed text.  Thank you for showing the differences.  This goes a long way as simple reference when trying to understand formatting.
0

Featured Post

Industry Leaders: 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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Suggested Courses

765 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