Solved

defining a field from a form in SQL

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
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.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

718 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