Solved

defining a field from a form in SQL

Posted on 2012-12-28
2
154 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

860 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