473,382 Members | 1,745 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,382 software developers and data experts.

How to fix "Compile Error Expected: end of statement" in a query?

I am a newbie in programing and is currently designing a program using VB6 with access 03 database. Unfortunately, I am stuck with the error. Please help me.. can't decipher the problem myself. Scenario is I have 4 tables (lightinfo, location, characteristics, and pics). They are connected through National ID from lightinfo.

Expand|Select|Wrap|Line Numbers
  1. strQuery = "SELECT LIGHTINFO.info_NationalNo, LIGHTINFO.info_InternationalNo, LIGHTINFO.info_namriaName, " & _
  2. "LIGHTINFO.info_cgNo, LIGHTINFO.info_cgName, LIGHTINFO.info_Category, LIGHTINFO.info_YearEstablished, " & _
  3. "LIGHTINFO.info_Chart Affected, LIGHTINFO.info_Comparison, LIGHTINFO.info_CGStation, LIGHTINFO.info_Authority, " & _
  4. "LIGHTINFO.info_LotOwner, LIGHTINFO.info_LightKeeper, LIGHTINFO.info_Remark, LOCATION.loc_Region, LOCATION.loc_Province, " & _
  5. "LOCATION.loc_MunCity, LOCATION.loc_Barangay, LOCATION.loc_LatPosition, LOCATION.loc_LongPosition, LOCATION.loc_PosAccuracy, " & _
  6. "LOCATION.loc_Datum, CHARACTERISTICS.c_CharType, CHARACTERISTICS.c_LantColor, CHARACTERISTICS.c_Period, CHARACTERISTICS.c_Elevation, " & _
  7. "CHARACTERISTICS.c_Range, CHARACTERISTICS.c_StrucType, CHARACTERISTICS.c_StrucColor, CHARACTERISTICS.c_StrucHeight, " & _
  8. "CHARACTERISTICS.c_DisplayStatus, CHARACTERISTICS.c_VisAnge, CHARACTERISTICS.c_VisArc, CHARACTERISTICS.c_FlashPhase, " & _
  9. "CHARACTERISTICS.c_IntensifiedColor, PICS.Pic_Image, PICS.Pic_Source " & _
  10. "FROM ((LIGHTINFO INNER JOIN CHARACTERISTICS ON LIGHTINFO.info_NationalNo = CHARACTERISTICS.c_NationalNo) " & _
  11.  "INNER JOIN LOCATION ON LIGHTINFO.info_NationalNo = LOCATION.loc_NationalNo) & _
  12. "INNER JOIN PICS ON LIGHTINFO.info_NationalNo = PICS.Pic_NationalNo"
  13.  
Feb 5 '11 #1
2 6539
Stewart Ross
2,545 Expert Mod 2GB
It's easy to overlook a double quote to end a substring in a complex VB-built SQL statement like this. The first Inner Join (line 11) is missing its ending double-quote, as shown below. The corrected version is also shown.

Expand|Select|Wrap|Line Numbers
  1.                                                                             v
  2. "INNER JOIN LOCATION ON LIGHTINFO.info_NationalNo = LOCATION.loc_NationalNo) & _
  3.                                                                             ^  
  4.  
  5. "INNER JOIN LOCATION ON LIGHTINFO.info_NationalNo = LOCATION.loc_NationalNo)" & _ 
-Stewart
Feb 6 '11 #2
thanks... so clumsy of me.
Feb 7 '11 #3

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

Similar topics

8
by: RC | last post by:
In my Access 2002 form, I have a combo box and on the AfterUpdate event I use DoCmd.RunSQL ("UPDATE .... to update records in a table. When it starts to run I get a message "You are about to...
1
by: Steve | last post by:
I get this message when I tried to make a .MDE of my database. "Compile error in hidden module: Form_frmPurchaseReq" I have been using this database for several months and just thought I would...
10
by: Chris LaJoie | last post by:
Our company has been developing a program in C# for some time now, and we haven't had any problems with it, but just last night something cropped up that has me, and everyone else, stumped. I...
2
by: yinglcs | last post by:
I have the following code, which use template as the parent class of my other class. But I have "instantiated from here" compile error at this line: class C: public B2<A>. Can some one...
3
by: wwwursa | last post by:
I am trying to use the Right function in a VB6 program. I have used it used many times before in other programs. When I press the enter key after entering the code line, the word "Right" turns...
6
by: JHNielson | last post by:
This is a very simple question.... I have a form that looks up Records for an unbound drop-down list. It has worked just fine up until last night. Now the button on the form to delete a record...
4
by: thebarefootnation | last post by:
Hi I have the following error message "Syntax Error (missing operator) in query expression" occurring when I am trying to update combo box within a form. My code is: Dim strSQL As String
4
by: James Lucero | last post by:
Below is my code. The error is "Compile Error Variable not defined". wdOrientLandscape is highlighted. Again this the portion of the code from a VB module created in Excel. The previous lines of code...
1
by: Dorota Prywata | last post by:
Hi, I need help with VBA Macro for Auto-filter to high lite a header plp advice as per below course a I got Compile error: Expected End Sub ? Sub Macro1() Function FilterOn(myCell As Range)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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...
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...

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.