473,511 Members | 16,260 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Specified field could refer to more than one table listed in SQL statement

1 New Member
I keep getting "The specified field "customer" could refer to more than one table listed in the FROM clause of your SQL statement. I understand what it means but I dont know how to change it. I have 11 tables in total.

Below is my statement:
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. SELECT informix_opheadm.date_entered, 
  4. informix_opheadm.date_required, 
  5. DateValue([informix_opheadm]![date_entered]) AS Expr1DEnt, 
  6. DateValue([informix_opheadm]![date_required]) AS Expr2DReq, 
  7. DateValue([informix_opheadm]![date_despatched]) AS Expr3DDes, 
  8. informix_opheadm.order_no, 
  9. informix_slcustm.customer, 
  10. informix_slcustm.name, 
  11. informix_opdetm.product, 
  12. informix_opdetm.product_group_a, 
  13. informix_opdetm.order_qty, 
  14. informix_opdetm.value, 
  15. informix_opdetm.warehouse, 
  16. informix_stockm.standard_labour, 
  17. informix_stockm.standard_overhead, 
  18. informix_stockm.standard_material, 
  19. informix_opheadm.transaction_anals1, 
  20. [informix_opheadm]![transaction_anals1]*[Expr1orderqty]/1000 AS Expr1LMEValue, 
  21. [Expr1orderqty]*[standard_labour] AS Expr1StandardLabour, 
  22. [Expr1orderqty]*[standard_overhead] AS Expr1StandardOverhead, 
  23. [standard_material]*[Expr1orderqty] AS Expr1StandardMaterial, 
  24. ([value]-[Expr1LMEValue]-[Expr1StandardLabour]-[Expr1StandardOverhead]-[Expr1StandardMaterial]) AS [Expr1Margin£], 
  25. [Expr1Margin£]/[Expr1OrderValue] AS [Expr1Margin%], 
  26. [net_price]*[order_qty] AS Expr1OrderValue, 
  27. informix_opdetm.net_price, 
  28. informix_opdetm.despatched_qty, 
  29. [Expr1StandardLabour]+[Expr1StandardOverhead]+[Expr1StandardMaterial] AS Expr1STDCOST, 
  30. [value]-[Expr1LMEValue] AS Expr1HVLVALUE, 
  31. [Expr1HVLVALUE]/[Expr1OrderValue] AS [Expr1HVL%], 
  32. [order_qty]-[despatched_qty] AS Expr1DES, 
  33. IIf([despatched_qty]>0,[despatched_qty],[order_qty]) AS Expr1orderqty, 
  34. [informix_opheadm]![transaction_anals1]/1000*[Expr1orderqty] AS [Expr1LME DESVALUE], 
  35. ([standard_overhead]+[standard_labour]+[standard_material])*[Expr1orderqty] AS Expr1stdvaluedes, 
  36. [Expr1DESmARGIN]/[value] AS [Expr1MARGINDES%], 
  37. [value]-[Expr1LME DESVALUE]-[Expr1stdvaluedes] AS Expr1DESmARGIN, 
  38. informix_opheadm.status, 
  39. informix_slcustm.territory, 
  40. informix_slcustm.class, 
  41. informix_opheadm.status, 
  42. Areas.Area, 
  43. informix_opheadm.order_no, 
  44. informix_opheadm.customer, 
  45. informix_opdetm.order_no
  46. FROM Areas 
  47. INNER JOIN (infoBetween "A001" And "XZ100"rmix_stockm 
  48. INNER JOIN ((informix_slcustm 
  49. INNER JOIN informix_opheadm 
  50. ON informix_slcustm.customer = informix_opheadm.customer) 
  51. INNER JOIN informix_opdetm 
  52. ON informix_opheadm.order_no = informix_opdetm.order_no) 
  53. ON (informix_stockm.product = informix_opdetm.product) 
  54. AND (informix_stockm.warehouse = informix_opdetm.warehouse)) 
  55. ON Areas.Territory = informix_slcustm.territory
  56. WHERE (((DateValue([informix_opheadm]![date_entered])) Between [Forms]![frmFindDates]![cmbStartDate] And [Forms]![frmFindDates]![cmbEndDate]) 
  57. AND ((DateValue([informix_opheadm]![date_required])) Between [Forms]![frmFindDates]![txtDateRequiredStart] And [Forms]![frmFindDates]![txtDateRequiredEnd]) 
  58. AND ((informix_opheadm.order_no) Between "04*" And "06*") AND ((informix_slcustm.customer) Between "A001" And "XZ100") AND ((informix_opdetm.warehouse) Between "10" And "79") 
  59. AND ((informix_opheadm.status) Between [Forms]![frmFindDates]![txtStartStatus] And [Forms]![frmFindDates]![txtEndStatus]));
  60.  
  61.  
Sep 8 '10 #1
1 2240
Stewart Ross
2,545 Recognized Expert Moderator Specialist
There is no obvious problem with your SQL statement, as all occurrences of the field name 'customer' are qualified with the relevant table names. It is a relatively complex statement with many clauses in the WHERE part. My feeling is that the error message is really reflecting the query engine finding the statement too complex to interpret.

Given that the SQL you show has no obvious syntax problem I'd suggest breaking this complex query down into at least two separate, simpler, queries which can be joined together to create the final result.

Breaking such a query into simpler components will also make it much easier to confirm by testing that the WHERE clauses are selecting the correct records and that any computed results are accurate.

-Stewart
Sep 8 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1537
by: Mr. Smart | last post by:
I have a middle-tier written using Foxpro. I'd like this tier to coommunicate (that is pass some variables to ASP). I defined a Session variable somewhere in my ASP file, e.g. Session("Usercode") =...
3
1557
by: Jeffrey | last post by:
Good day all, I have seen so many postings dealing with MS Access as a security risk and other items, yet I see now clear reason why. I would really like someone to point me in the right...
3
17266
by: Larry Woods | last post by:
Anyone have an Access 97 runtime? Or know where there's a download? There shouldn't be any problem giving me a copy since you can send it out free with any *.mdb/*mde. TIA, Larry Woods
5
7260
by: Darren Smith | last post by:
Hi There, I have a shopping cart app that displays products along with a textbox (to enter quantity) and an image button to add the item to the shopping cart. Please explain why my below...
9
3300
by: cj | last post by:
I'm trying to forge ahead with Visual Basic .Net but recently I've suffered several major set backs in demonstrating VB is the future and we should move from Visual FoxPro. I really need to find...
12
1877
by: Karina | last post by:
Hello: I am taking over someone else's code and my users are experiencing tons of problems but when I try to go into the source code to edit and try to fix these problems, I realize that all the...
1
1424
by: SMS | last post by:
Hi, We have our web-site developed in classic ASP, and I need to add this additional feature on one of the pages to access a VB application. How can I do that? The VB application basically...
0
921
by: insideview | last post by:
Hi there - when attempting to install Python 2.3.5, I receive the following message -- "You do not have access to make the required system configuration modifications." Please rerun this...
2
2401
by: karrans | last post by:
Hi, I'm trying to debug some code where I'm trying to retrieve particular ranges in an excel sheet into an Access table, depending on the user selection of the range name in a combo box with a...
1
1280
by: jmc | last post by:
I am setting up a new database at work and I am having troubles with the security. It is a simple database with 1 table, form and report. I have set up user names and passwords to get in. Is there...
0
7242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7418
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5662
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3212
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
446
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.