473,670 Members | 2,563 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Syntax Error in Query Expression

3 New Member
here is my SQL statement:

Expand|Select|Wrap|Line Numbers
  1. SELECT [SPO Data Entry Table].[SPO#]
  2.      , [Standard Brk].*
  3.      , [Standard SubBrk].*
  4. FROM  ([SPO Data Entry Table]
  5.        INNER JOIN
  6.        [Standard Brk]
  7.   ON   [SPO Data Entry Table].[SPO#] = CDBL([Standard Brk.[SPO#]]))
  8.        INNER JOIN
  9.        [Standard SubBrk]
  10.   ON   [Standard Brk].[Test #] = [Standard SubBrk].[Unit No]
when trying to run the query I get the syntax error in query expression within the FROM clause: [SPO Data Entry Table].[SPO#] = CDBL([Standard Brk.[SPO]]))

those two fields are different types
spo data entry table.SPO# = autonumber
Standard Brk.SPO = text
Sep 8 '11 #1
6 2784
NeoPa
32,569 Recognized Expert Moderator MVP
If you look at the reference passed to CDBL() in line #7 you'll see :
Expand|Select|Wrap|Line Numbers
  1. [Standard Brk.[SPO]]
The closing bracket (]) that should be after Standard Brk is found after the closing bracket of [SPO] instead. Did you not look at the error message? It's pretty clear from that what the problem is.
Sep 8 '11 #2
D Rid
3 New Member
Thank you for your help....this is new to me. I have made the changes you suggested. I am now getting a type mismatch in experssion

What am I doing wrong?

Expand|Select|Wrap|Line Numbers
  1. SELECT [SPO Data Entry Table].[SPO#]
  2.      , [Standard Brk].*
  3.      , [Standard SubBrk].*
  4. FROM  ([SPO Data Entry Table]
  5.        INNER JOIN
  6.        [Standard Brk]
  7.   ON   [SPO Data Entry Table].[SPO#] = CDBL([Standard Brk].[SPO#]))
  8.        INNER JOIN
  9.        [Standard SubBrk]
  10.   ON   [Standard Brk].[Test #] = [Standard SubBrk].[Unit No]
Sep 8 '11 #3
NeoPa
32,569 Recognized Expert Moderator MVP
[SPO Data Entry Table].[SPO#] is an AutoNumber field (IE. Long), but you're comparing it to a value returned from CDbl(). Use Int() or CLng() instead.
Sep 8 '11 #4
D Rid
3 New Member
I am now getting an Type mismatch error. I have used both Int() and CLng() and get the same error message for both. I appreciate all the help. Here is what my SQL statement looks like now.

Expand|Select|Wrap|Line Numbers
  1. SELECT [SPO Data Entry Table].[SPO#]
  2.      , [Standard Brk].*
  3.      , [Standard SubBrk].*
  4. FROM   ([SPO Data Entry Table]
  5.        INNER JOIN
  6.        [Standard Brk]
  7.   ON   [SPO Data Entry Table].[SPO#] = CLng([Standard Brk].[SPO#]))
  8.        INNER JOIN
  9.        [Standard SubBrk]
  10.   ON   [Standard Brk].[Test #] = [Standard SubBrk].[Unit No]
Sep 12 '11 #5
NeoPa
32,569 Recognized Expert Moderator MVP
I just used the time I had available fixing your post. Such a waste of your time. Please read [code] Tags Must be Used before posting again.
Sep 12 '11 #6
NeoPa
32,569 Recognized Expert Moderator MVP
If you're still getting a Type Mismatch error then I would assume that both of your comparisons (Lines #7 & #10) originally had problems. Line #7 should be alright now, which leaves the obvious question :
What are the Types of the two fields referenced on line #10 ([Test #] & [Unit No])?
Sep 12 '11 #7

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

Similar topics

29
2477
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules" for when and how to use single quotes and double quotes in ASP? thanks! ---------------------- SQL = SQL & "WHERE '" & REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE("GenKTitles.
3
3102
by: KevLow | last post by:
Hi, Hope some kind soul can help me out here.. I'm trying to programmatically modify the column headings of a crosstab query such that it can be dynamic based on user specified period (Month Year to Month Year) So far i have tried to use the following code: //
1
1652
by: amitbadgi | last post by:
I am gettign this error while converting an asp application to asp.net , its a query syntax error, Exception Details: System.Runtime.InteropServices.COMException: Syntax error in query expression 'id =System.__ComObject'. Source Error: Line 191: counter = 1Line 192: for i = 0 to ubound(emaillist)Line 193: rs_email = conn.execute("select * from tblusers where id =" & emaillist(i))Line 194: tolist = tolist & rs_email("email") &...
1
2339
by: amitbadgi | last post by:
I am geting the following error while conv an asp to asp.net Exception Details: System.Runtime.InteropServices.COMException: Syntax error in query expression 'id =System.__ComObject'. Source Error: Line 196: for i = 0 to ubound(emaillist) Line 197: selectsqlstatement = "select * from tblusers where id =" & emaillist(i)
7
6877
by: John Øllgård Jensen | last post by:
Hi Using MS Asccess 2000: In a query I'm trying to create a new field with following expression: FilmDate: Left(,4) The field "FilmNo" is another text field in the query. This is expression should return the 4 leftmost characters of the FilmNo
2
1819
by: Tom Baxter | last post by:
I have a numeric column in a query called Prov1.Volume. When I try taking the sum of that column (using SUM aggregate function in Design View) it gives a syntax error. It says that SumOfProv1.Volume is an invalid name. How do I get around this error. (note: the name is Prov1.Volume because the column name came from an inner join. Is there a way to rename this column and possibly thereby avoid the error? Sums of other columns work...
1
4356
by: parveen.beniwal | last post by:
hi all i am having the following line of code in my mak file. !IF "$(CFG)" == "" CFG=DesktopCommon - Win32 Release !MESSAGE No configuration specified. Defaulting to DesktopCommon - Win32 Release.
4
11684
by: srinathvs | last post by:
Hi, I have an access db that I am trying to query from a vb6 program. I've the following code: Dim sSQLQuery As String sSQLQuery = "SELECT * FROM TblData WHERE ID = " & Chr(39) & ID & Chr(39) ID here is equal to 1234567890 MsgBox sSQLQuery the msgbox says: SELECT * FROM TblData WHERE ID = '1234567890 Note that the quotation is missing at the end Set rs = db.OpenRecordset(sSQLQuery, dbOpenDynaset)
7
2842
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...
5
8829
by: rolltide | last post by:
I've seen many similar threads, but despite repeated efforts I cannot figure out my problem. I am running Access 2003, VB 6.5, Office XP Pro. Code excerpt is below (you can see where I've tried debugging myself). My problem is in the DLookup command. UserName = Me.cboUserName.Value Debug.Print "User Name is "; UserName strPassword = DLookup("Password", "Employees", "EmpName ='" & UserName) Debug.Print "Password is ";...
0
8466
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8384
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8591
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
8659
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
7412
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
4388
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2799
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
2
2037
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1791
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.