Going to the Next Line

  • Thread starter Thread starter Alimbilo
  • Start date Start date
A

Alimbilo

Hello,
I am trying to write some code for my database but the field come to the end
and I can't find a way to go to the next line by keeping the same idea? Is
there a way to keep on going without breaking the code (to the next line
whenever the first line is at the end?



This is a long example:

Call CarryOver(Me, strMsg, "RCTTotalRepaired", "RCTTotalScrap",
"RCTTotalPending", "RCTTotalTouch", "RCTTotalHoursUsed",
"RCTTotalHoursTouched", "RCTTotalHourRepair", "RSSTotalMovedIROS",
"RSSTotalBoardsMOvedIROSBB", "RSSTotalPhonesBoardsScrapped",
"TotalRSSTransfered", "TotalHoursRefurbOnly", "TotalHoursFlashRF",
"TotalRepairHours", "GrandTotalAllHours", "LG3200RefurbishQty",
"LG3200RefurbishHours", "LG3200PhoneoerHours", "LG3200STDMinsPhone",
"LG3200StdHrsEarned", "LG3300RefurbishQty", "LG3300RefurbishHours",
"LG3300PhoneoerHours", "LG3300STDMinsPhone", "LG3300StdHrsEarned",
"LG4400RefurbishQty", "LG4400RefurbishHours", "LG4400PhoneoerHours",
"LG4400STDMinsPhone", "LG4400StdHrsEarned", "LG4500RefurbishQty",
"LG4500RefurbishHours", "LG4500PhoneoerHours", "LG4500STDMinsPhone",
"LG4500StdHrsEarned", "LG6100RefurbishQty", "LG6100RefurbishHours",
"LG6100PhoneoerHours", "LG6100STDMinsPhone", "LG6100StdHrsEarned", Call
CarryOver(Me, strMsg, "RCTTotalRepaired", "RCTTotalScrap", "RCTTotalPending",
"RCTTotalTouch", "RCTTotalHoursUsed", "RCTTotalHoursTouched",
"RCTTotalHourRepair", "RSSTotalMovedIROS", "RSSTotalBoardsMOvedIROSBB",
"RSSTotalPhonesBoardsScrapped", "TotalRSSTransfered", "TotalHoursRefurbOnly",
"TotalHoursFlashRF", "TotalRepairHours", "GrandTotalAllHours",
"LG3200RefurbishQty", "LG3200RefurbishHours", "LG3200PhoneoerHours",
"LG3200STDMinsPhone", "LG3200StdHrsEarned", "LG3300RefurbishQty",
"LG3300RefurbishHours", "LG3300PhoneoerHours", "LG3300STDMinsPhone",
"LG3300StdHrsEarned", "LG4400RefurbishQty", "LG4400RefurbishHours",
"LG4400PhoneoerHours", "LG4400STDMinsPhone", "LG4400StdHrsEarned",
"LG4500RefurbishQty", "LG4500RefurbishHours", "LG4500PhoneoerHours",
"LG4500STDMinsPhone", "LG4500StdHrsEarned", "LG6100RefurbishQty",
"LG6100RefurbishHours", "LG6100PhoneoerHours", "LG6100STDMinsPhone",
"LG6100StdHrsEarned", "Motorolav710RefurbishQty",
"Motorolav710RefurbishHours", "Motorolav710PhoneoerHours", Call CarryOver(Me,
strMsg, "RCTTotalRepaired", "RCTTotalScrap", "RCTTotalPending",
"RCTTotalTouch", "RCTTotalHoursUsed", "RCTTotalHoursTouched",
"RCTTotalHourRepair", "RSSTotalMovedIROS", "RSSTotalBoardsMOvedIROSBB",
"RSSTotalPhonesBoardsScrapped", "TotalRSSTransfered", "TotalHoursRefurbOnly",
"TotalHoursFlashRF", "TotalRepairHours", "GrandTotalAllHours",
"LG3200RefurbishQty", "LG3200RefurbishHours", "LG3200PhoneoerHours",
"LG3200STDMinsPhone", "LG3200StdHrsEarned", "LG3300RefurbishQty",
"LG3300RefurbishHours", "LG3300PhoneoerHours", "LG3300STDMinsPhone",
"LG3300StdHrsEarned", "LG4400RefurbishQty", "LG4400RefurbishHours",
"LG4400PhoneoerHours", "LG4400STDMinsPhone", "LG4400StdHrsEarned",
"LG4500RefurbishQty", "LG4500RefurbishHours", "LG4500PhoneoerHours",
"LG4500STDMinsPhone", "LG4500StdHrsEarned", "LG6100RefurbishQty",
"LG6100RefurbishHours", "LG6100PhoneoerHours", "LG6100STDMinsPhone",
"LG6100StdHrsEarned", "Motorolav710RefurbishQty",
"Motorolav710RefurbishHours", "Motorolav710PhoneoerHours"Call CarryOver(Me,
strMsg, "RCTTotalRepaired", "RCTTotalScrap", "RCTTotalPending",
"RCTTotalTouch", "RCTTotalHoursUsed", "RCTTotalHoursTouched",
"RCTTotalHourRepair", "RSSTotalMovedIROS", "RSSTotalBoardsMOvedIROSBB",
"RSSTotalPhonesBoardsScrapped", "TotalRSSTransfered", "TotalHoursRefurbOnly",
"TotalHoursFlashRF", "TotalRepairHours", "GrandTotalAllHours",
"LG3200RefurbishQty", "LG3200RefurbishHours", "LG3200PhoneoerHours",
"LG3200STDMinsPhone", "LG3200StdHrsEarned", "LG3300RefurbishQty",
"LG3300RefurbishHours", "LG3300PhoneoerHours", "LG3300STDMinsPhone",
"LG3300StdHrsEarned", "LG4400RefurbishQty", "LG4400RefurbishHours",
"LG4400PhoneoerHours", "LG4400STDMinsPhone", "LG4400StdHrsEarned",
"LG4500RefurbishQty", "LG4500RefurbishHours", "LG4500PhoneoerHours",
"LG4500STDMinsPhone", "LG4500StdHrsEarned", "LG6100RefurbishQty",
"LG6100RefurbishHours", "LG6100PhoneoerHours", "LG6100STDMinsPhone",
"LG6100StdHrsEarned", "Motorolav710RefurbishQty",
"Motorolav710RefurbishHours", "Motorolav710PhoneoerHours")
 
In the VB Editor, the underscore character _ can be used as a line break. It
means this line of code continues on the next physical line. However, if you
are building a long string, you have to terminate the string on the first
line before you continue to the next and continue it with the & concatenation
character. For example:

strLongString = "This is a very long string I can't see if I put it all
on _
One Line so I will break it in to pieces I can see"

Will not work. It has to be:

strLongString = "This is a very long string I can't see if I put it all
on " & _
"One Line so I will break it in to pieces I can see"

There is a limit to the number of continuation lines you can use for one
logical line of code, but I can't remember what it is. With a line that
long, you may hit the limit. The work around is to then use an additional
line by contatenating the string to itself:

strLongString = "This is a very long string I can't see if I put it all
on " & _
"One Line so I will break it in to pieces I can see"

strLingString = strLongString & " This is how I make it work if I exceed
" & _
"the number of times VBE allows using the line continuation character"
 
I tried that but still getting error messages.
Just to remind you, this how my code is:
Call CarryOver(Me, strMsg, "RCTTotalRepaired", "RCTTotalScrap",
"RCTTotalPending", "RCTTotalTouch", "RCTTotalHoursUsed", and so on...)

Thanks
 
The problem is you are trying to put several function calls on the same line.
That you cannot do. You need to start a new line with each call to
CarryOver:

Call CarryOver(Me, strMsg, "RCTTotalRepaired", "RCTTotalScrap", _
"RCTTotalPending", "RCTTotalTouch", "RCTTotalHoursUsed", _
"RCTTotalHoursTouched", "RCTTotalHourRepair", "RSSTotalMovedIROS", _
"RSSTotalBoardsMOvedIROSBB", "RSSTotalPhonesBoardsScrapped", _
"TotalRSSTransfered", "TotalHoursRefurbOnly", "TotalHoursFlashRF", _
"TotalRepairHours", "GrandTotalAllHours", "LG3200RefurbishQty", _
"LG3200RefurbishHours", "LG3200PhoneoerHours", "LG3200STDMinsPhone", _
"LG3200StdHrsEarned", "LG3300RefurbishQty", "LG3300RefurbishHours", _
"LG3300PhoneoerHours", "LG3300STDMinsPhone", "LG3300StdHrsEarned", _
"LG4400RefurbishQty", "LG4400RefurbishHours", "LG4400PhoneoerHours", _
"LG4400STDMinsPhone", "LG4400StdHrsEarned", "LG4500RefurbishQty", _
"LG4500RefurbishHours", "LG4500PhoneoerHours", "LG4500STDMinsPhone", _
"LG4500StdHrsEarned", "LG6100RefurbishQty", "LG6100RefurbishHours", _
"LG6100PhoneoerHours", "LG6100STDMinsPhone", "LG6100StdHrsEarned")
Call CarryOver(Me, strMsg, "RCTTotalRepaired", "RCTTotalScrap", _

And so on.
 
Hello,
I need your help soloving this issue.

I have 2 tables in my database and would like to have a:

Field A in Table A to be equal to Field C in Table B.
I have tried so far to do: Field A = [Table B]![Field C]
but I am getting a "#Name?# error.
 
Hello,
I need your help soloving this issue.

I have 2 tables in my database and would like to have a:

Field A in Table A to be equal to Field C in Table B.
I have tried so far to do: Field A = [Table B]![Field C]
but I am getting a "#Name?# error.

STOP.

Your design is WRONG.

Information should be stored in one place and one place only. Store the value
in FieldC in TableB, and *ONLY* store it there. Storing it redundantly in
TableA is *not* good practice; you will end up with the "same" value stored in
two different places, and will risk errors if one table gets edited and the
other doesn't. You'll now have two different values for the field, and one of
them WILL BE WRONG, with no easy way to tell which.

Secondly, TableB might have 3225124 records. Which one of those records
contains the value that you want?

Read about relational databases and how they work. Right now you seem to be on
the wrong track. See:

Jeff Conrad's resources page:
http://www.accessmvp.com/JConrad/accessjunkie/resources.html

The Access Web resources page:
http://www.mvps.org/access/resources/index.html

A free tutorial written by Crystal (MS Access MVP):
http://allenbrowne.com/casu-22.html

MVP Allen Browne's tutorials:
http://allenbrowne.com/links.html#Tutorials
 
Back
Top