Solved

Open subform based on current record

Posted on 2012-12-27
2
713 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 250 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
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 specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

688 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