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

Help: Continue String Code to next line

ok, I'm trying to write a string code and currently the code works
however I've run out of room and I need to change some of the source
names it pulls from. Changing the source names create the string
longer and there is no room left. I need to know how I can split this
into two or more lines so I can update the code now and in the future.

strSQL = "SELECT tblEmployees.LastName, tblOutputs.OutputName,
tblBudgetedFigures.BudgetedTime, Sum(tblTimesheetEntries.Hours) AS
SumOfHours, [SumOfHours]/[BudgetedTime] AS PercentUsed,
tblSections.SectionID, tblSections.Section,
Sum(tblTimesheetEntries.TravelExpenses) AS SumOfTravelExpenses,
tblBudgetedFigures.TravelExpenses, IIf([Sumoftravelexpenses]=0,0,
[SumofTravelExpenses]/[tblbudgetedfigures].[TravelExpenses]) AS
PercentUsedTravel FROM tblSections INNER JOIN (tblOutputs INNER JOIN
((tblEmployees INNER JOIN tblBudgetedFigures ON
tblEmployees.EmployeeID = tblBudgetedFigures.EmployeeName) INNER JOIN
tblTimesheetEntries ON tblEmployees.EmployeeID =
tblTimesheetEntries.EmployeeID) ON (tblOutputs.OutputID =
tblTimesheetEntries.Output) AND (tblOutputs.OutputID =
tblBudgetedFigures.OutputName)) ON tblSections.SectionID =
tblEmployees.Section GROUP BY tblEmployees.LastName,
tblOutputs.OutputName, tblBudgetedFigures.BudgetedTime,
tblSections.SectionID, tblSections.Section,
tblBudgetedFigures.TravelExpenses "

I hope someone can help, I've run out of ideas.

Oct 3 '07 #1
4 10457
fhwa <Ro**********@fhwa.dot.govwrote:
ok, I'm trying to write a string code and currently the code works
however I've run out of room and I need to change some of the source
names it pulls from. Changing the source names create the string
longer and there is no room left. I need to know how I can split this
into two or more lines so I can update the code now and in the future.

strSQL = "SELECT tblEmployees.LastName, tblOutputs.OutputName,
tblBudgetedFigures.BudgetedTime, Sum(tblTimesheetEntries.Hours) AS
SumOfHours, [SumOfHours]/[BudgetedTime] AS PercentUsed,
tblSections.SectionID, tblSections.Section,
Sum(tblTimesheetEntries.TravelExpenses) AS SumOfTravelExpenses,
tblBudgetedFigures.TravelExpenses, IIf([Sumoftravelexpenses]=0,0,
[SumofTravelExpenses]/[tblbudgetedfigures].[TravelExpenses]) AS
PercentUsedTravel FROM tblSections INNER JOIN (tblOutputs INNER JOIN
((tblEmployees INNER JOIN tblBudgetedFigures ON
tblEmployees.EmployeeID = tblBudgetedFigures.EmployeeName) INNER JOIN
tblTimesheetEntries ON tblEmployees.EmployeeID =
tblTimesheetEntries.EmployeeID) ON (tblOutputs.OutputID =
tblTimesheetEntries.Output) AND (tblOutputs.OutputID =
tblBudgetedFigures.OutputName)) ON tblSections.SectionID =
tblEmployees.Section GROUP BY tblEmployees.LastName,
tblOutputs.OutputName, tblBudgetedFigures.BudgetedTime,
tblSections.SectionID, tblSections.Section,
tblBudgetedFigures.TravelExpenses "

I hope someone can help, I've run out of ideas.
Do you mean verbatim string literals (with an @ prefix)?

string x = @"First line
second line
third line";

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Oct 3 '07 #2
sorry, I don't really know what you mean. I'm fairly new to the whole
VBA coding and am updating some access databases for my office that
has this code. The code above currently runs all in a single line
which runs out of room and doesn't allow me to add more because of the
character limit. For example, I need to change tblOutputs to
tblOutputs2008, thus making the line longer however it doesn't allow
me to. What I ultimately need to do is figure out a way to split the
code onto two separate lines and have the code continue to work and
read from the end of the first line and continue at the beginning of
the second. I hope this description helps. Thanks

Oct 3 '07 #3
On Oct 3, 3:12 pm, fhwa <Robert.Ad...@fhwa.dot.govwrote:
sorry, I don't really know what you mean. I'm fairly new to the whole
VBA coding and am updating some access databases for my office that
has this code. The code above currently runs all in a single line
which runs out of room and doesn't allow me to add more because of the
character limit. For example, I need to change tblOutputs to
tblOutputs2008, thus making the line longer however it doesn't allow
me to. What I ultimately need to do is figure out a way to split the
code onto two separate lines and have the code continue to work and
read from the end of the first line and continue at the beginning of
the second. I hope this description helps. Thanks
This is a C# newsgroup, not a VB one, so you will need to ask in an
appropriate group.

Chris

Oct 3 '07 #4

Use table aliases in the statement.
ie.

"SELECT tblEmployees.LastName, tblOutputs.OutputName,
tblBudgetedFigures.BudgetedTime, Sum(tblTimesheetEntries.Hours) AS
SumOfHours, [SumOfHours]/[BudgetedTime] AS PercentUsed,
s.SectionID, s.Section,
Sum(tblTimesheetEntries.TravelExpenses) AS SumOfTravelExpenses,
tblBudgetedFigures.TravelExpenses, IIf([Sumoftravelexpenses]=0,0,
[SumofTravelExpenses]/[tblbudgetedfigures].[TravelExpenses]) AS
PercentUsedTravel FROM tblSections s INNER JOIN (tblOutputs INNER JOIN
((tblEmployees INNER JOIN tblBudgetedFigures ON
tblEmployees.EmployeeID = tblBudgetedFigures.EmployeeName) INNER JOIN
tblTimesheetEntries ON tblEmployees.EmployeeID =
tblTimesheetEntries.EmployeeID) ON (tblOutputs.OutputID =
tblTimesheetEntries.Output) AND (tblOutputs.OutputID =
tblBudgetedFigures.OutputName)) ON s.SectionID =
tblEmployees.Section GROUP BY tblEmployees.LastName,
tblOutputs.OutputName, tblBudgetedFigures.BudgetedTime,
tblSections.SectionID, s.Section,
tblBudgetedFigures.TravelExpenses "

Basically in a FROM clause or JOIN clause type table alias then you can use
alias.Column instead of table.Column that should save you a few characters

"fhwa" <Ro**********@fhwa.dot.govwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
sorry, I don't really know what you mean. I'm fairly new to the whole
VBA coding and am updating some access databases for my office that
has this code. The code above currently runs all in a single line
which runs out of room and doesn't allow me to add more because of the
character limit. For example, I need to change tblOutputs to
tblOutputs2008, thus making the line longer however it doesn't allow
me to. What I ultimately need to do is figure out a way to split the
code onto two separate lines and have the code continue to work and
read from the end of the first line and continue at the beginning of
the second. I hope this description helps. Thanks
Oct 4 '07 #5

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

Similar topics

3
by: laurie | last post by:
Hi all, I'm trying to help out a friend who has inherited a client with a PHP shopping cart application. Neither of us know PHP, but I've been muddling my way through, trying to get these old...
31
by: da Vinci | last post by:
OK, this has got to be a simple one and yet I cannot find the answer in my textbook. How can I get a simple pause after an output line, that simply waits for any key to be pressed to move on? ...
15
by: Buck Rogers | last post by:
Hi guys! Task 1: Write a program which presents a menu with 5 options. The 5th option quits the program. Each option should execute a system command using system(). Below is my humble...
9
by: daniel | last post by:
Hi everyone, I'm trying to get this program compiled under Solaris. Unfortunately I have little experience with C. Solaris doesn't use the function strsep() anymore: char *strsep(char...
66
by: genestarwing | last post by:
QUESTION: Write a program that opens and read a text file and records how many times each word occurs in the file. Use a binary search tree modified to store both a word and the number of times it...
18
by: vermarajeev | last post by:
Hello everybody, This is my second query in this post. Firstly thankx to Banfa, for helping me solve my first query. Here is the code which I have written. #include<iostream>...
7
by: Gasten | last post by:
Hello. The last weeks I've been coding a roguelike (you know, like nethack) in python using the nCurses library. Some week ago I ran into a problem: When I made the object for messagebar-output, I...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
2
by: fhwa | last post by:
ok, I'm trying to write a string code and currently the code works however I've run out of room and I need to change some of the source names it pulls from. Changing the source names create the...
6
by: Extremest | last post by:
Does anyone know how to decode a yenc encoded file? I have created a decoder that seems to work great for text. Now i am trying to create another one for images and I can't get it to work. I...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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.