473,385 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

The specified field could refer to more than one table listed in the FROM clause

I am getting this error after running my query

The specified field [contractnum] could refer to more than one table listed in the FROM clause of your SQL statement. (Error 3079)

my contractnum is a one to many to another table.

how do i fix this?
Jul 2 '07 #1
4 12208
NeoPa
32,556 Expert Mod 16PB
You have (accidentally) posted this question in the Access Articles section. This is NOT an article.
I'm moving this to the main Access questions forum.

MODERATOR.
Jul 2 '07 #2
NeoPa
32,556 Expert Mod 16PB
I suspect this is quite straightforward, but posting a copy of the SQL that is triggering the error message would prove helpful.
From there we can tell you precisely what to fix.
Jul 2 '07 #3
nico5038
3,080 Expert 2GB
You'll have to "qualify" the field [contractnum] as it's apperently part of two tables.
Let's assume you have the tables tblA and tblB, then use e.g.:
[tblA].[contractnum]
When it's tblA having the needed value. For a full (INNER) join the table won't matter, but when you have an outer (LEFT or RIGHT) join (there's an arrow displayed instead of a line), then make sure you use the "master" table to qualify the field

Nic;o)
Jul 3 '07 #4
jcgads
5
I get the same error message (the Datasheet View works). My SQL is

SELECT CONTRACT_ITEMS.EXP_DATE, Format([CONTRACT_ITEMS.EXP_DATE],"mmmm") AS Expr1, Format([CONTRACT_ITEMS.EXP_DATE],"mm") AS Expr2, Trim([ENTITY_1.FIRST_NAME]) & " " & Trim([ENTITY_1.LAST_NAME]) AS Expr3, CONTRACT_BUDGETS.FISCAL_YEAR, CONTRACT_BUDGETS.FYR_NOTES, ENTITY.LAST_NAME, CONTRACT_SPACE.CONTRACT_DESC, CONTRACT_SPACE.CONTRACT_TYPE, CONTRACT_SPACE.RENEWAL_DATE, CONTRACT_BUDGETS.FYR_BUDGET, CONTRACT_SPACE.EXP_DATE, CONTRACT_BUDGETS.FYR_SPENT, ENTITY_1.FIRST_NAME, ENTITY_1.LAST_NAME, CONTRACT_ITEMS.COMMENT
FROM (ENTITY AS ENTITY_1 RIGHT JOIN ((ENTITY INNER JOIN (CONTRACT_SPACE LEFT JOIN CONTRACT_ITEMS ON CONTRACT_SPACE.CONTRACT_ID = CONTRACT_ITEMS.CONTRACT_ID) ON ENTITY.ID = CONTRACT_SPACE.VENDOR_ID) LEFT JOIN CONTRACT_OWNERS ON CONTRACT_SPACE.CONTRACT_ID = CONTRACT_OWNERS.CONTRACT_ID) ON ENTITY_1.ID = CONTRACT_OWNERS.OWNER_ID) LEFT JOIN CONTRACT_BUDGETS ON CONTRACT_SPACE.CONTRACT_ID = CONTRACT_BUDGETS.CONTRACT_ID
WHERE (((Format([CONTRACT_ITEMS.EXP_DATE],"mmmm"))>=Format(Now(),"mmmm")) AND ((Format([CONTRACT_ITEMS.EXP_DATE],"mm"))>=Format(Now(),"mm")-2) AND ((CONTRACT_BUDGETS.FISCAL_YEAR)=Year(Now())));

Any help would be appreciated.
Dec 2 '09 #5

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

Similar topics

20
by: | last post by:
If I need to check if a certain value does exist in a field, and return either "yes" or "not" which query would be the most effestive?
5
by: Colleyville Alan | last post by:
I have built a SQL statement that is trying to loop through the fields of a table that was built from a spreadsheet and hence is "short and fat". So rather than hard-coding, I have a loop from...
10
by: MLH | last post by:
I have an A97 table with a Yes/No field named TowJob and a form bound to that table. The TowJob control on the form is bound to the same field. It is an option group with Yes and No bttns valued...
8
by: Bri | last post by:
Greetings, I am using Eval() in a query with only limited success. If the text within the function contains a reference to a Field I get #ERROR#. I'll try and explain what I'm trying to do and...
3
by: Kevin Rollo | last post by:
I'm playing with a generic routine to export data, the concept is to have a list of data driven templates defining what fields to output. Evaluating a simple variable field name in the function...
4
by: Kathy | last post by:
I have a query that is being created in code. When the query is executed I get the error: "The specified field 'Acct' could refer to more than one table listed in the FROM clause". As you can...
12
by: Bill Moran | last post by:
Hey all. I've hit an SQL problem that I'm a bit mystified by. I have two different questions regarding this problem: why? and how do I work around it? The following query: SELECT GCP.id,...
38
by: sopranos2 | last post by:
Dear IBM DB2 support, I wish CLP would have been more functional. Without living the command line I would like to get sql return code explanations, scalar function definitions etc.. Looking...
3
by: =?Utf-8?B?UGF1bCBQcmV3ZXR0?= | last post by:
I'm attempting to use LINQ to insert a record into a child table and I'm receiving a "Specified cast is not valid" error that has something to do w/ the keys involved. The stack trace is: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...

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.