PDA

View Full Version : Concatenate variables and email them


hcardose
12-12-2005, 01:40 PM
hi there again.

I'm trying to send a mail with some information. I already sent the mail. the problem is that I have several filds in a table that I need to put together in a variable, with line breaks.

dim ase, ad, cdm, co, cs, dl, ef, lc, ed, evt, pf, lgp, em, te, tur, cursos

set ase = rs("ase")
set ad = rs("ad")
set cdm = rs("cdm")
set co = rs("co")
set cs = rs("cs")
set dl = rs("dl")
set ef = rs("ef")
set lc = rs("1c")
set ed = rs("ed")
set pf = rs("pf")
set lgp = rs("lgp")
set em = rs("em")
set te = rs("te")
set tur = rs("tur")

set cursos = ase & " " & ad & " " & cdm & " " & co & " " & cs & " " & dl & " " & ef & " " & lc & " " & ed & " " & pf & " " & lgp & " " & em & " " & te & " " & tur

the problem is that I receive this message while trying to send the mail:
"Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: '[string: "Animação Socioeducat"]'
/nesp_2$/admin/classificados_diversos_ins_executemail.asp, line 41"

where "Animação Socioeducativa" is the content of the ase variable and the line 41 is the above line "set cursos = ase & " " &...

if someone can help me: tkxs

PS.: how can I do the break lines in line 41?

best regards to all

BarrMan
12-12-2005, 01:59 PM
ase = rs("ase")
ad = rs("ad")
cdm = rs("cdm")
co = rs("co")
cs = rs("cs")
dl = rs("dl")
ef = rs("ef")
lc = rs("1c")
ed = rs("ed")
pf = rs("pf")
lgp = rs("lgp")
em = rs("em")
te = rs("te")
tur = rs("tur")

cursos = ase & " " & ad & " " & cdm & " " & co & " " & cs & " " & dl & " " & ef & " " & lc & " " & ed & " " & pf & " " & lgp & " " & em & " " & te & " " & tur

hcardose
12-12-2005, 04:11 PM
your help was very good. I have only one other problem.
in the line 42 (cursos = ase & " " & ad & " " &...) I already solve the problem of line breaks.
the line now looks like this:
cursos = ase & vbCrLf & ad & vbCrLf & cdm & vbCrLf & co & vbCrLf & cs & vbCrLf & dl & vbCrLf & ef & vbCrLf & lc & vbCrLf & ed & vbCrLf & pf & vbCrLf & lgp & vbCrLf & em & vbCrLf & te & vbCrLf & tur

the problem is that I need to verify if each variable "inside" cursos is not empty.

so I tried this:
cursos = if len(ase) > 1 then ase & vbCrLf & end if ad & vbCrLf & cdm & vbCrLf & co & vbCrLf & cs & vbCrLf & dl & vbCrLf & ef & vbCrLf & lc & vbCrLf & ed & vbCrLf & pf & vbCrLf & lgp & vbCrLf & em & vbCrLf & te & vbCrLf & tur

but I get a Microsoft VBScript compilation (0x800A03EA)
Syntax error
/nesp_2$/admin/classificados_diversos_ins_executemail.asp, line 41, column 9

any ideia?
tkx

BarrMan
12-12-2005, 04:26 PM
if len(ase) > 1 then
curos = ase & vbCrLf & ad & vbCrLf & cdm & vbCrLf & co & vbCrLf & cs & vbCrLf & dl & vbCrLf & ef & vbCrLf & lc & vbCrLf & ed & vbCrLf & pf & vbCrLf & lgp & vbCrLf & em & vbCrLf & te & vbCrLf & tur
end if