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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

newbie question

Status
Not open for further replies.

56stingray

Programmer
May 21, 2007
2
US
how does one 'split' a line of code into 2 lines on screen?
 
You have to be more specific.

Is it:
Code:
str = "This is my text " & _
"and this is a second line"
what you want?


Have fun.

---- Andy
 
here is the code i am working on
it is intending to creat a string variable that will be used to execute an sql command
it is too long to fit on one line
the "second" line yields a comile error???

strSQL1 = "Insert into tblimport_TPStransactions (date,time,authno,cardno,tcno,fpi,reserved1,reserved2,tripno,unitno,
driverno,reserved3,trancode1,trailerno,dispatchno,tsname,tscity,tsstate,
diesel_gallons,diesel_total,diesel_ppg,gasoline_gallons,gasoline_total,
cashadv,hub,oil_qty,oil_total,reefer_gallons,reefer_total,additive_qty,
additive_total,parts_total,tire_rep_qty,tire_rep_total,tire_purch_qty,
tire_purch_total,permit_total,motel_total,scales_total,wash_total,
meals_total,trancode2,tsno,reserved4,driver_name,chain_pin,reserved5,
misc_qty,misc_total,discounts,rebates,sales_tax,invoiceno,invoice_total,
ts_amount,fuel_type) values(#" & FormatDateTime(ds("date"), vbShortDate) & "#,'" & ds("time") & "','" & ds("authno") & "','" & ds("cardno") & "','" & ds("tcno") & "','" & ds("fpi") & "','" & ds("reserved1") & "','" & ds("reserved2") & "','" & ds("tripno") & "','" & ds("unitno") & "','" & ds("driverno") & "','" & ds("reserved3") & "','" & ds("trancode1") & "','" & ds("trailerno") & "','" & Replace(ds("tsname"), "'", "'") & "','" & Replace(ds("tscity"), "'", "'") & "','" & ds("tsstate") & "'," & ds("diesel_gallons") & "," & ds("diesel_total") & ",'" & ds("diesel_service") & "'," & ds("diesel_ppg") & "," & ds("gasoline_gallons") & "," & ds("gasoline_total") & "," & ds("cashadv") & ",'" & ds("hub") & "'," & ds("oil_qty") & "," & ds("oil_total") & "," & ds("reefer_gallons") & "," & ds("reefer_total") & "," & ds("additive_qty") & "," & ds("additive_total") & "," & ds("parts_total") & "," & ds("tire_rep_qty") & "," & ds("tire_rep_total") & "," & ds("tire_purch_qty") & "," & ds("tire_purch_total")&
"," & ds("permit_total") & ",'" & ds("trancode2") & "','" & ds("tsno") & "'," & ds("reserved4") & ",'"
 
You will still use the underscore at the end of a line to tell the VBE that the line wraps.

Example:

Code:
(date,time,authno,cardno,tcno,fpi,reserved1,reserved2, _
tripno,unitno,driverno,reserved3,trancode1,trailerno, _
dispatchno,tsname,tscity,tsstate,diesel_gallons, _
....


[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 

You may do this:
Code:
strSQL1 = "Insert into tblimport_TPStransactions values(#" & FormatDateTime(ds("date"), vbShortDate) & "#, " _
& " '" & ds("time") & "','" & ds("authno") & "','" & ds("cardno") & "','" & ds("tcno") & "', " _
& " '" & ds("fpi") & "','" & ds("reserved1") & "','" & ds("reserved2") & "','" & ds("tripno") & "'," _
& " '" & ds("unitno") & "','" & ds("driverno") & "','" & ds("reserved3") & "','" & ds("trancode1") & "'," _
& " '" & ds("trailerno") & "','" & Replace(ds("tsname"), "'", "''") & "','" & Replace(ds("tscity"), "'", "''") & "'," _
& " '" & ds("tsstate") & "'," & ds("diesel_gallons") & "," & ds("diesel_total") & ",'" & ds("diesel_service") & "'," _
& " " & ds("diesel_ppg") & "," & ds("gasoline_gallons") & "," & ds("gasoline_total") & "," & ds("cashadv") & "," _
& " '" & ds("hub") & "'," & ds("oil_qty") & "," & ds("oil_total") & "," & ds("reefer_gallons") & "," & ds("reefer_total") & "," _
& " " & ds("additive_qty") & "," & ds("additive_total") & "," & ds("parts_total") & "," & ds("tire_rep_qty") & "," _
& " " & ds("tire_rep_total") & "," & ds("tire_purch_qty") & "," & ds("tire_purch_total") & "," _
& " " & ds("permit_total") & ",'" & ds("trancode2") & "','" & ds("tsno") & "'," & ds("reserved4") & ",'"

or do something like
Code:
strSQL1 = "Insert into tblimport_TPStransactions values(#" & FormatDateTime(ds("date"), vbShortDate) & "#, " _
& " '" & ds("time") & "','" & ds("authno") & "','" & ds("cardno") & "','" & ds("tcno") & "', "

strSQL1 = strSQL1 & " '" & ds("fpi") & "','" & ds("reserved1") & "','" & ds("reserved2") & "','" & ds("tripno") & "'," _
& " '" & ds("unitno") & "','" & ds("driverno") & "','" & ds("reserved3") & "','" & ds("trancode1") & "',"

strSQL1 = strSQL1 & " '" & ds("trailerno") & "','" & Replace(ds("tsname"), "'", "''") & "','" & Replace(ds("tscity"), "'", "''") & "'," _
& " '" & ds("tsstate") & "'," & ds("diesel_gallons") & "," & ds("diesel_total") & ",'" & ds("diesel_service") & "',"

strSQL1 = strSQL1 & " " & ds("diesel_ppg") & "," & ds("gasoline_gallons") & "," & ds("gasoline_total") & "," & ds("cashadv") & "," _
& " '" & ds("hub") & "'," & ds("oil_qty") & "," & ds("oil_total") & "," & ds("reefer_gallons") & "," & ds("reefer_total") & ","

strSQL1 = strSQL1 & " " & ds("additive_qty") & "," & ds("additive_total") & "," & ds("parts_total") & "," & ds("tire_rep_qty") & "," _
& " " & ds("tire_rep_total") & "," & ds("tire_purch_qty") & "," & ds("tire_purch_total") & ","

strSQL1 = strSQL1 & " " & ds("permit_total") & ",'" & ds("trancode2") & "','" & ds("tsno") & "'," & ds("reserved4") & ",'"

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top