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

probs using line continuation characters

MLH
I don't understand why (a) works and compiles but (b) does not...

(a)
Set qdfTemp = .CreateQueryDef("", _
"SELECT * FROM Employees")

(b)
Set qdfTemp = .CreateQueryDef("", _
"SELECT DISTINCTROW tblPmtsRcd.PmtID,
tblPmtsRcd.InvoiceNumber, tblPmtsRcd.VehicleJobID,
tblPmtsRcd.PmtRecTDStamp _
FROM tblPmtsRcd LEFT JOIN tblinvoiceData ON
tblPmtsRcd.InvoiceNumber = tblinvoiceData.InvoiceNumber _
WHERE tblPmtsRcd.InvoiceNumber<>0 And tblPmtsRcd.InvoiceNumber
Is Not Null AND tblinvoiceData.InvoiceNumber Is Null")
' Open Recordset and print report.
GetrstTemp qdfTemp

Isn't (b) just a longer SQL string with continuation characters and
(a) a shorter SQL string with continuation characters?

Everytime I type the Set statement in (b) into a module, it turns
red and gives me an error. I do not recognize what is wrong.
With the damned newsreader wrapping - you may not be able
to see what I'm doing wrong either. Sorry about that. Would
like to know. If I type EVERYTHING on one line - no problem.
But when I try using line continuation characters everything
turns red.
Jun 27 '08 #1
3 4430
On Thu, 01 May 2008 19:10:57 -0400, MLH <CR**@NorthState.netwrote:
>I don't understand why (a) works and compiles but (b) does not...

(a)
Set qdfTemp = .CreateQueryDef("", _
"SELECT * FROM Employees")

(b)
Set qdfTemp = .CreateQueryDef("", _
"SELECT DISTINCTROW tblPmtsRcd.PmtID,
tblPmtsRcd.InvoiceNumber, tblPmtsRcd.VehicleJobID,
tblPmtsRcd.PmtRecTDStamp _
FROM tblPmtsRcd LEFT JOIN tblinvoiceData ON
tblPmtsRcd.InvoiceNumber = tblinvoiceData.InvoiceNumber _
WHERE tblPmtsRcd.InvoiceNumber<>0 And tblPmtsRcd.InvoiceNumber
Is Not Null AND tblinvoiceData.InvoiceNumber Is Null")
' Open Recordset and print report.
GetrstTemp qdfTemp

Isn't (b) just a longer SQL string with continuation characters and
(a) a shorter SQL string with continuation characters?

Everytime I type the Set statement in (b) into a module, it turns
red and gives me an error. I do not recognize what is wrong.
With the damned newsreader wrapping - you may not be able
to see what I'm doing wrong either. Sorry about that. Would
like to know. If I type EVERYTHING on one line - no problem.
But when I try using line continuation characters everything
turns red.
In b, you have the continuation character in the middle of a literal
string (" on both ends), but not in a.

If you need to continue a literal string there are a couple of options

SQL = "First part of the string " & _
"continuation of string " & _
"last line of string"

SQL = "First part of the string " _
& "continuation of string " _
& "last line of string"

Jun 27 '08 #2
MLH
Are you sure I'm in the middle of a literal string?
I don't think that's the case.

>
In b, you have the continuation character in the middle of a literal
string (" on both ends), but not in a.

If you need to continue a literal string there are a couple of options

SQL = "First part of the string " & _
"continuation of string " & _
"last line of string"

SQL = "First part of the string " _
& "continuation of string " _
& "last line of string"
Jun 27 '08 #3
MLH
Oops. My bad. Sorry... now I see it.
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

145
by: David MacQuigg | last post by:
Playing with Prothon today, I am fascinated by the idea of eliminating classes in Python. I'm trying to figure out what fundamental benefit there is to having classes. Is all this complexity...
11
by: Russell Wallace | last post by:
Hi all, Python lets you continue a single logical line across more than one physical line, either by putting a \ at the end or letting it happen automatically with an incomplete infix operator....
5
by: Sandra-24 | last post by:
I'm not sure how complex this is, I've been brainstorming a little, and I've come up with: If the previous line ended with a comma or a \ (before an optional comment) That's easy to cover...
11
by: prats | last post by:
I want to write a GUI application in PYTHON using QT. This application is supposed to take in Japanese characters. I am using PyQt as the wrapper for using QT from python. I am able to take input...
13
by: Don | last post by:
Hi, I have an SQL string that I'm trying to code into VBA and it's giving me trouble. I tried to use line continuation and concatenation as best I can to make it work. However, I'm stuck. I know...
4
by: Lawrence D'Oliveiro | last post by:
The Python docs recommend the use of triple-quoted string literals for docstrings, e.g. def Meet(Alice, Bob) : """arranges a meeting between Alice and Bob. Returns a reference to the meeting...
3
by: psbasha | last post by:
Hi , I am following backslash ('\') as continuation of line as per the coding guidelines.Is there any other character to be used as continuation of line? Thanks in advance PSB
4
by: Phoe6 | last post by:
Hi, I have a configfile, in fact, I am providing a configfile in the format: Name: Foo Author: Bar Testcases: tct123
6
by: Russ P. | last post by:
I've always appreciated Python's lack of requirement for a semi-colon at the end of each line. I also appreciate its rules for automatic line continuation. If a statement ends with a "+", for...
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: 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...
0
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,...
0
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...
0
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...
0
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
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...

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.