Solved

defining a field from a form in SQL

Posted on 2012-12-28
2
152 Views
Last Modified: 2013-01-02
I have a form, [EOS Ranking], which has a command button to call for another form.  I set the record based on the filter criteria [item_number]

I had to change my subform and it now it too  includes a field [item_number] as well so, where this string worked before, it no longer does.

DoCmd.OpenForm "sfrm_sales_xref_data", WhereCondition:="Item_Number = '" & [ITEM_NUMBER] & "'"

I think I need to define that [item_number] is coming from my primary form [EOS Ranking]

How would I rewrite my script?
0
Comment
Question by:MCaliebe
2 Comments
 
LVL 30

Accepted Solution

by:
hnasr earned 125 total points
ID: 38728523
Try:

DoCmd.OpenForm "sfrm_sales_xref_data", WhereCondition:="Item_Number = '" & Forms!theParentForm![ITEM_NUMBER] & "'"

Where theParentForm is the Main form containing sfrm_sales_xref_data subform.
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 38728697
If this line of code is inside the subform, you could also use the Parent keyword to refer to the main form:
DoCmd.OpenForm "sfrm_sales_xref_data", WhereCondition:="Item_Number = '" & Parent.[ITEM_NUMBER] & "'"
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Run report based on combo box selection - access 2007 2 19
A Function to parse a text string 4 34
Top 1 of each supplier 55 55
update all email addresses SQL 1 23
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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…

776 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