473,654 Members | 2,974 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Syntax Error - Right join

10 New Member
strSQL = "SELECT tblf107grpDept. DeptName AS Org, tblUsers.UserFN ame + ' ' + tblUsers.UserLN ame AS Requestor,CONVE RT(varchar,
tblF107Log.RecD ate) + ' EST' AS [Date Received], tblF107Log.Comm ents AS Comments, tblF107Log.IDFr m FROM dbo_tblF107grpD ept
RIGHT JOIN tblUsers ON tblF107grpDept. IDDept = tblUsers.IDDept fk RIGHT JOIN tblF107Log ON tblUsers.UserID =
tblF107Log.IDCo ntact WHERE IDFrm = " & request.queryst ring("IDForm") & ";"
Set rsCoordinationS ection = objConn.Execute (strSQL)


This is the error I am getting from the code above:

Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression 'tblF107grpDept .IDDept = tblUsers.IDDept fk RIGHT JOIN tblF107Log ON tblUsers.UserID = tblF107Log.IDCo ntact'.


I am also getting an error stating the convert function is undefined. The SQL was created, I think, for SQL server 2000, but I am trying to get it to work with ACCESS 2003. Any help or suggestions will be greatly appreciated.

Thanks!
Aug 28 '06 #1
3 4259
MMcCarthy
14,534 Recognized Expert Moderator MVP
Add in a space before the word CONVERT.

Either remove the dbo_ from the table name dbo_tblF107grpD ept or add it in all the time.

Also bracket off the joins as follows:

FROM ((tblF107grpDep t RIGHT JOIN tblUsers ON tblF107grpDept. IDDept = tblUsers.IDDept fk) RIGHT JOIN tblF107Log ON tblUsers.UserID = tblF107Log.IDCo ntact)



strSQL = "SELECT tblf107grpDept. DeptName AS Org, tblUsers.UserFN ame + ' ' + tblUsers.UserLN ame AS Requestor,CONVE RT(varchar,
tblF107Log.RecD ate) + ' EST' AS [Date Received], tblF107Log.Comm ents AS Comments, tblF107Log.IDFr m FROM dbo_tblF107grpD ept
RIGHT JOIN tblUsers ON tblF107grpDept. IDDept = tblUsers.IDDept fk RIGHT JOIN tblF107Log ON tblUsers.UserID =
tblF107Log.IDCo ntact WHERE IDFrm = " & request.queryst ring("IDForm") & ";"
Set rsCoordinationS ection = objConn.Execute (strSQL)


This is the error I am getting from the code above:

Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression 'tblF107grpDept .IDDept = tblUsers.IDDept fk RIGHT JOIN tblF107Log ON tblUsers.UserID = tblF107Log.IDCo ntact'.


I am also getting an error stating the convert function is undefined. The SQL was created, I think, for SQL server 2000, but I am trying to get it to work with ACCESS 2003. Any help or suggestions will be greatly appreciated.

Thanks!
Aug 29 '06 #2
BigGuy316
10 New Member
I tried everything you mentioned, but now I am getting a syntax error message saying error in join operation. Here is the current code:

strSQL = "SELECT tblf107grpDept. DeptName AS Org, tblUsers.UserFN ame + ' ' + tblUsers.UserLN ame AS Requestor,

CONVERT(varchar , tblF107Log.RecD ate) + ' EST' AS [Date Received], tblF107Log.Comm ents AS Comments, tblF107Log.IDFr m FROM

((tblF107grpDep t Right Join tblUSers on tblF107grpDept. IDDept = tblUsers.IDDept fk) Right Join tblF107Log on

tblUsers.UserId = tblF107Log.IDCo ntact) WHERE IDFrm = " & request.queryst ring("IDForm")& ";"

Thanks for the help and suggestion. I still don't know what is wrong.
Aug 30 '06 #3
MMcCarthy
14,534 Recognized Expert Moderator MVP
FROM ((tblF107grpDep t Right Join tblUSers on tblF107grpDept. IDDept = tblUsers.IDDept fk) Right Join tblF107Log on tblUsers.UserId = tblF107Log.IDCo ntact)

Because you are getting an error on the join expression I would suggest that you do the following:

Check all the table names - if you are using an odbc connection you have to use the table name that is showing in access. However, if you are connecting using ADO straight to the backend or using a SQL pass thru query then you have to use the table name in the SQL backend. Check for dbo. or dbo_ before the table names.

Check all your connection fields - are they of the same type when used in connections. Have you got the field names correct?

Lastly if you are using an odbc connection to link your tables then put the sql statement into a blank query and go to design view. This can sometimes make the problem obvious.

I tried everything you mentioned, but now I am getting a syntax error message saying error in join operation. Here is the current code:

strSQL = "SELECT tblf107grpDept. DeptName AS Org, tblUsers.UserFN ame + ' ' + tblUsers.UserLN ame AS Requestor,

CONVERT(varchar , tblF107Log.RecD ate) + ' EST' AS [Date Received], tblF107Log.Comm ents AS Comments, tblF107Log.IDFr m FROM

((tblF107grpDep t Right Join tblUSers on tblF107grpDept. IDDept = tblUsers.IDDept fk) Right Join tblF107Log on

tblUsers.UserId = tblF107Log.IDCo ntact) WHERE IDFrm = " & request.queryst ring("IDForm")& ";"

Thanks for the help and suggestion. I still don't know what is wrong.
Aug 30 '06 #4

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

Similar topics

3
5946
by: Phil Powell | last post by:
I'm not kidding, the only reason yesterday you didn't hear from me was because I wasn't coding, but today I am doing something quick, and yes, as always it failed.. right at the SQL statement: $sql = 'SELECT v.nnet_produkt_varegruppe_navn, ' . ' f.nnet_produkt_farge_navn, ' . ' s.nnet_produkt_storrelse_navn, ' . ' k.nnet_produkt_kvalitet_navn, ' . ' p.* ' .
14
3071
by: sam | last post by:
When I run this SQL query: SELECT u.*, o.* FROM users u, orders o WHERE TO_DAYS(o.order_date) BETWEEN TO_DAYS('2003-09-20')-10 AND TO_DAYS('2003-09-20')+10
699
33862
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro capabilities, unfortunately. I'd like to know if it may be possible to add a powerful macro system to Python, while keeping its amazing syntax, and if it could be possible to add Pythonistic syntax to Lisp or Scheme, while keeping all of the...
23
1857
by: middletree | last post by:
I've seen posts here and elsewhere which read something along the lines of "PULLNG MY HAIR OUT!!!!!" or "HELLLLPPP!". Well, I know that kind of subject line isn't descriptive, but I sure can relate right now. I've been struggling for days--days!!-- on this one simple query. I really need to get past this thing and move on. Please help. I have a classic ASP page, and it gives you 4 dropdowns. You can select any or none of them....
0
1166
by: Kevin Michael Reed | last post by:
------=_NextPart_000_002B_01C34DF8.C34C94F0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Assistance required. I have 3 tables:
8
3162
by: p | last post by:
I'm trying to put a query into VBA code and its giving me difficulties. I would like to put the following query: SELECT tbl_Workload.Priority, tbl_Workload.Number AS Num, tbl_Workload.Name, tbl_Workload.Comment AS Comment, tbl_Workload.EmpID, tbl_Workload.TaskID, tbl_Jobs.ID FROM tbl_Workload LEFT JOIN tbl_Jobs ON tbl_Workload.Number = tbl_Jobs.Number WHERE (((tbl_Workload.EmpID)=..)) ORDER BY tbl_Workload.Priority, tbl_Workload.Number;
4
2148
by: Ole Nielsby | last post by:
In the old ages when I was taught Pascal, the manual had nice syntax diagrams. Each grammatical structure was shown as round boxes connected by arrows, with a model railway look, with the boxes representing either lexical tokens or other diagrams (i.e. terminals/nonterminals). They seemed very intuitive because you could toot-toot one finger along the rails in the book while moving another finger over your code. Does anything similar...
3
4073
bilibytes
by: bilibytes | last post by:
Hello, i need some help i am getting this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP BY w.location_id ORDER BY w.wine_id ASC' at line 1 the entire query code is: SELECT
7
2841
by: Yesurbius | last post by:
I am receiving the following error when attempting to run my query. In my mind - this error should not be happening - its a straight-forward query with a subquery. I am using Access 2003 with all the latest patches. If I do not group the query (ie. remove aggregation) it will work. If I recall, it also works if my subquery does not have joins. I want to accomplish this with pure SQL .. I could easily write a VBA function to handle...
0
8815
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8707
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8482
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8593
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7306
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5622
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4149
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2714
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.