Solved

defining a field from a form in SQL

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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
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…

738 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