473,503 Members | 2,075 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.UserFName + ' ' + tblUsers.UserLName AS Requestor,CONVERT(varchar,
tblF107Log.RecDate) + ' EST' AS [Date Received], tblF107Log.Comments AS Comments, tblF107Log.IDFrm FROM dbo_tblF107grpDept
RIGHT JOIN tblUsers ON tblF107grpDept.IDDept = tblUsers.IDDeptfk RIGHT JOIN tblF107Log ON tblUsers.UserID =
tblF107Log.IDContact WHERE IDFrm = " & request.querystring("IDForm") & ";"
Set rsCoordinationSection = 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.IDDeptfk RIGHT JOIN tblF107Log ON tblUsers.UserID = tblF107Log.IDContact'.


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 4244
MMcCarthy
14,534 Recognized Expert Moderator MVP
Add in a space before the word CONVERT.

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

Also bracket off the joins as follows:

FROM ((tblF107grpDept RIGHT JOIN tblUsers ON tblF107grpDept.IDDept = tblUsers.IDDeptfk) RIGHT JOIN tblF107Log ON tblUsers.UserID = tblF107Log.IDContact)



strSQL = "SELECT tblf107grpDept.DeptName AS Org, tblUsers.UserFName + ' ' + tblUsers.UserLName AS Requestor,CONVERT(varchar,
tblF107Log.RecDate) + ' EST' AS [Date Received], tblF107Log.Comments AS Comments, tblF107Log.IDFrm FROM dbo_tblF107grpDept
RIGHT JOIN tblUsers ON tblF107grpDept.IDDept = tblUsers.IDDeptfk RIGHT JOIN tblF107Log ON tblUsers.UserID =
tblF107Log.IDContact WHERE IDFrm = " & request.querystring("IDForm") & ";"
Set rsCoordinationSection = 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.IDDeptfk RIGHT JOIN tblF107Log ON tblUsers.UserID = tblF107Log.IDContact'.


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.UserFName + ' ' + tblUsers.UserLName AS Requestor,

CONVERT(varchar, tblF107Log.RecDate) + ' EST' AS [Date Received], tblF107Log.Comments AS Comments, tblF107Log.IDFrm FROM

((tblF107grpDept Right Join tblUSers on tblF107grpDept.IDDept = tblUsers.IDDeptfk) Right Join tblF107Log on

tblUsers.UserId = tblF107Log.IDContact) WHERE IDFrm = " & request.querystring("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 ((tblF107grpDept Right Join tblUSers on tblF107grpDept.IDDept = tblUsers.IDDeptfk) Right Join tblF107Log on tblUsers.UserId = tblF107Log.IDContact)

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.UserFName + ' ' + tblUsers.UserLName AS Requestor,

CONVERT(varchar, tblF107Log.RecDate) + ' EST' AS [Date Received], tblF107Log.Comments AS Comments, tblF107Log.IDFrm FROM

((tblF107grpDept Right Join tblUSers on tblF107grpDept.IDDept = tblUsers.IDDeptfk) Right Join tblF107Log on

tblUsers.UserId = tblF107Log.IDContact) WHERE IDFrm = " & request.querystring("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
5938
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: ...
14
3057
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
33319
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...
23
1837
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...
0
1159
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
3153
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,...
4
2142
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...
3
4035
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...
7
2831
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...
0
7316
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...
1
6975
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...
0
7449
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...
0
5562
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,...
1
4992
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
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
3160
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
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1495
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 ...

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.