Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Coninuation ( _) Not Working 1

Status
Not open for further replies.

EdAROC

Programmer
Aug 27, 2002
93
US
I can't believe I am stuck!
Here's the command, edited with " _", and I get an error dialog box:

"Compile Error:
Expected: end of statement"

dbo_ORD_MACH_OPS - on the 2nd line is highlighted.
When I remove the continuation marks (put it back the way it was) it executes (I even removed the tabs that were inserted at the beginning of each line):

strSQL = "SELECT dbo_ORD_MACH_OPS.MACH_NO as Machine, dbo_ORD_MACH_OPS.ORDER_NO as Job, _
dbo_ORD_MACH_OPS.SPEC_NO as Spec, dbo_ORD_MACH_OPS.ITEM_NO as Item, dbo_ORD_MACH_OPS.FORM_NO as Form _
FROM dbo_ORD_MACH_OPS _
INNER JOIN MACHINES ON dbo_ORD_MACH_OPS.MACH_NO = MACHINES.MACH_NO _
WHERE (((dbo_ORD_MACH_OPS.ORDER_NO) = " & JNo & ") And ((dbo_ORD_MACH_OPS.FORM_NO) = " & FNo & ") _
And dbo_ORD_MACH_OPS.REPLACED_MACH_NO Is Null And (MACHINES.SCHEDCARDS_FLG = 'Y')) _
ORDER BY dbo_ORD_MACH_OPS.MACH_SEQ_NO"

I'm so confused. :-(
(Do I need to remove the line leading tabs that are auto inserted for indentation?)
 
strSQL = "SELECT dbo_ORD_MACH_OPS.MACH_NO as Machine, dbo_ORD_MACH_OPS.ORDER_NO as Job, [!]"[/!]_
[!] & "[/!]dbo_ORD_MACH_OPS.SPEC_NO as Spec, dbo_ORD_MACH_OPS.ITEM_NO as Item, dbo_ORD_MACH_OPS.FORM_NO as Form [!]"[/!]_
...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I find that is very hard to do and to debug. Try something like this
Code:
strSql = "SELECT dbo_ORD_MACH_OPS.MACH_NO as Machine, dbo_ORD_MACH_OPS.ORDER_NO as Job,"

strSql = strSql & "dbo_ORD_MACH_OPS.SPEC_NO as Spec, dbo_ORD_MACH_OPS.ITEM_NO as Item,"

strSql = StrSql & "......"

This is makes it a lot easier to debug because along the way you can put in a debug.print.

However for a string in general

x = " adfsdfdsf" & _
    "ghghsdfsdfsd" & _
    "klklkjkl" & _

You need to close the quotes, you need an ampersand, you need a space after the ampersand.
 
Or as PHV showed you can put the continuation character and the ampersand on the next line.
 
Dang! ::)
It was right there in front of me in the 705-833660 thread - A literal string needs to be closed and re-opened.
Am I dense or what? (-:

Thanks, to both of you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top