ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Compile Error (https://www.excelbanter.com/excel-programming/349936-compile-error.html)

CurtH

Compile Error
 
I get this compile error with syntax. Code is:

Src = "SELECT * " _
& "FROM MedicalStatus " _
& "WHERE (((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR Action
Items" )= 'Y')); "

bpeltzer

Compile Error
 
"WHERE (((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR Action
Items" )= 'Y')); "

The double-quotes aren't paired in this WHERE clause...

"CurtH" wrote:

I get this compile error with syntax. Code is:

Src = "SELECT * " _
& "FROM MedicalStatus " _
& "WHERE (((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR Action
Items" )= 'Y')); "


CurtH

Compile Error
 
Meaning that I should use them? What you insert looks exactly like the
original code.

"bpeltzer" wrote:

"WHERE (((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR Action
Items" )= 'Y')); "

The double-quotes aren't paired in this WHERE clause...

"CurtH" wrote:

I get this compile error with syntax. Code is:

Src = "SELECT * " _
& "FROM MedicalStatus " _
& "WHERE (((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR Action
Items" )= 'Y')); "


Tom Ogilvy

Compile Error
 
If the error is just building the string, then perhaps:
Tested from the immediate window:

Src = "SELECT * " _
& "FROM MedicalStatus " _
& "WHERE (((UNIT)='125 LOGISTICS READINES SQ')" _
& " AND ((IMR Action Items)='Y')); "



--
Regards,
Tom Ogilvy


"CurtH" wrote in message
...
I get this compile error with syntax. Code is:

Src = "SELECT * " _
& "FROM MedicalStatus " _
& "WHERE (((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR Action
Items" )= 'Y')); "




bpeltzer

Compile Error
 
Meaning that they should alway occur in pairs unless you intend them to be
part of the resulting expression. I don't think you want them in your final
SQL expression, but you've got three double quotes on the line (and yes, I
posted back exactly your original code to highlight the line that has the
imbalance).
Perhaps:
"WHERE (((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR Action Items )=
'Y'));"

"CurtH" wrote:

Meaning that I should use them? What you insert looks exactly like the
original code.

"bpeltzer" wrote:

"WHERE (((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR Action
Items" )= 'Y')); "

The double-quotes aren't paired in this WHERE clause...

"CurtH" wrote:

I get this compile error with syntax. Code is:

Src = "SELECT * " _
& "FROM MedicalStatus " _
& "WHERE (((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR Action
Items" )= 'Y')); "


CurtH

Compile Error
 
Okay. I understand now. Thanks!

"CurtH" wrote:

Meaning that I should use them? What you insert looks exactly like the
original code.

"bpeltzer" wrote:

"WHERE (((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR Action
Items" )= 'Y')); "

The double-quotes aren't paired in this WHERE clause...

"CurtH" wrote:

I get this compile error with syntax. Code is:

Src = "SELECT * " _
& "FROM MedicalStatus " _
& "WHERE (((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR Action
Items" )= 'Y')); "


CurtH

Compile Error
 
eThanks for the input. Both options seem toresolve the issue. But, now I
get Run-time error' -2147217900 (80040e14)': Syntax error (missing operator)
in query "(((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR ACTION TEM)='Y'))'.
Once I select debug this line of code is highlighted:
..Open Source:=Src, ActiveConnection:=Connection

Please advise.



"Tom Ogilvy" wrote:

If the error is just building the string, then perhaps:
Tested from the immediate window:

Src = "SELECT * " _
& "FROM MedicalStatus " _
& "WHERE (((UNIT)='125 LOGISTICS READINES SQ')" _
& " AND ((IMR Action Items)='Y')); "



--
Regards,
Tom Ogilvy


"CurtH" wrote in message
...
I get this compile error with syntax. Code is:

Src = "SELECT * " _
& "FROM MedicalStatus " _
& "WHERE (((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR Action
Items" )= 'Y')); "





Andrew Taylor

Compile Error
 
The parentheses aren't balanced in the SQL statement. Delete one of
the three before UNIT.



CurtH wrote:
eThanks for the input. Both options seem toresolve the issue. But, now I
get Run-time error' -2147217900 (80040e14)': Syntax error (missing operator)
in query "(((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR ACTION TEM)='Y'))'.
Once I select debug this line of code is highlighted:
.Open Source:=Src, ActiveConnection:=Connection

Please advise.



"Tom Ogilvy" wrote:

If the error is just building the string, then perhaps:
Tested from the immediate window:

Src = "SELECT * " _
& "FROM MedicalStatus " _
& "WHERE (((UNIT)='125 LOGISTICS READINES SQ')" _
& " AND ((IMR Action Items)='Y')); "



--
Regards,
Tom Ogilvy


"CurtH" wrote in message
...
I get this compile error with syntax. Code is:

Src = "SELECT * " _
& "FROM MedicalStatus " _
& "WHERE (((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR Action
Items" )= 'Y')); "






CurtH

Compile Error
 
Still same result.

"Andrew Taylor" wrote:

The parentheses aren't balanced in the SQL statement. Delete one of
the three before UNIT.



CurtH wrote:
eThanks for the input. Both options seem toresolve the issue. But, now I
get Run-time error' -2147217900 (80040e14)': Syntax error (missing operator)
in query "(((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR ACTION TEM)='Y'))'.
Once I select debug this line of code is highlighted:
.Open Source:=Src, ActiveConnection:=Connection

Please advise.



"Tom Ogilvy" wrote:

If the error is just building the string, then perhaps:
Tested from the immediate window:

Src = "SELECT * " _
& "FROM MedicalStatus " _
& "WHERE (((UNIT)='125 LOGISTICS READINES SQ')" _
& " AND ((IMR Action Items)='Y')); "



--
Regards,
Tom Ogilvy


"CurtH" wrote in message
...
I get this compile error with syntax. Code is:

Src = "SELECT * " _
& "FROM MedicalStatus " _
& "WHERE (((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR Action
Items" )= 'Y')); "






Andrew Taylor

Compile Error
 
OK, now i look at it more closely, you need
square brackets round the column names. Try this:

Src = "SELECT * " _
& "FROM MedicalStatus " _
& "WHERE (([UNIT]='125 LOGISTICS READINES SQ')" _
& " AND ([IMR Action Items]='Y')); "



CurtH wrote:
Still same result.

"Andrew Taylor" wrote:

The parentheses aren't balanced in the SQL statement. Delete one of
the three before UNIT.



CurtH wrote:
eThanks for the input. Both options seem toresolve the issue. But, now I
get Run-time error' -2147217900 (80040e14)': Syntax error (missing operator)
in query "(((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR ACTION TEM)='Y'))'.
Once I select debug this line of code is highlighted:
.Open Source:=Src, ActiveConnection:=Connection

Please advise.



"Tom Ogilvy" wrote:

If the error is just building the string, then perhaps:
Tested from the immediate window:

Src = "SELECT * " _
& "FROM MedicalStatus " _
& "WHERE (((UNIT)='125 LOGISTICS READINES SQ')" _
& " AND ((IMR Action Items)='Y')); "



--
Regards,
Tom Ogilvy


"CurtH" wrote in message
...
I get this compile error with syntax. Code is:

Src = "SELECT * " _
& "FROM MedicalStatus " _
& "WHERE (((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR Action
Items" )= 'Y')); "







CurtH

Compile Error
 
Thanks! That did it. I have oneother question. If I want to select
multiple units or all units. How can I edit the "where" code to do so?

"Andrew Taylor" wrote:

OK, now i look at it more closely, you need
square brackets round the column names. Try this:

Src = "SELECT * " _
& "FROM MedicalStatus " _
& "WHERE (([UNIT]='125 LOGISTICS READINES SQ')" _
& " AND ([IMR Action Items]='Y')); "



CurtH wrote:
Still same result.

"Andrew Taylor" wrote:

The parentheses aren't balanced in the SQL statement. Delete one of
the three before UNIT.



CurtH wrote:
eThanks for the input. Both options seem toresolve the issue. But, now I
get Run-time error' -2147217900 (80040e14)': Syntax error (missing operator)
in query "(((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR ACTION TEM)='Y'))'.
Once I select debug this line of code is highlighted:
.Open Source:=Src, ActiveConnection:=Connection

Please advise.



"Tom Ogilvy" wrote:

If the error is just building the string, then perhaps:
Tested from the immediate window:

Src = "SELECT * " _
& "FROM MedicalStatus " _
& "WHERE (((UNIT)='125 LOGISTICS READINES SQ')" _
& " AND ((IMR Action Items)='Y')); "



--
Regards,
Tom Ogilvy


"CurtH" wrote in message
...
I get this compile error with syntax. Code is:

Src = "SELECT * " _
& "FROM MedicalStatus " _
& "WHERE (((UNIT)='125 LOGISTICS READINES SQ') AND ((IMR Action
Items" )= 'Y')); "









All times are GMT +1. The time now is 12:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com