Microsoft VBScript runtime error '800a01a8'

L

led

Microsoft VBScript runtime error '800a01a8'

Object required: ''

this is the error i get with this code



<%
Dim meumail
Dim myCDONTSMail
Dim strFrom
Dim strTo
Dim strSubject
Dim strBody
Dim strparamim
Dim strSubject2
Dim strBody2

Dim myConnString
Dim myConnection
Dim mySQL
dim id

strFrom="(e-mail address removed)"

strSubject2="Alteração de disponibilidade"
strBody2="Alteracao"

id=request.form("id")

myConnString = Application("basededados1_ConnectionString")


Set myConnection = Server.CreateObject("ADODB.Connection")


myConnection.Open myConnString


mySQL= "DELETE prereserva.* FROM prereserva WHERE id="

mySQL=mySQL & request.form("id")
mySQL=mySQL & " And situacao='Aguarda confirmação com envio de sinal de
30%'"

Response.Write(mysql)


set recs=Server.CreateObject("ADODB.recordset")
recs.Open "SELECT prereserva.* FROM prereserva WHERE id="& id & "And
situacao='Aguarda confirmação com envio de sinal de 30%'", myConnString



do while not recs.eof
strTo=recs.Fields.Item("email")
strSubject = "Pré reserva " & recs.Fields.Item("n_prereserva")& " foi
suplantada "

strBody = "<html>"
strBody = strBody & "<head></head>"
strBody = strBody & "<body>"
strBody = strBody & Chr(13) & "A sua prereserva foi suplantada"

strBody = strBody & Chr(13) & "Obrigado.Esperamos que o nosso serviço vá de
encontro ás suas expectativas."
strBody = strBody & "</body>"

strBody = strBody & "</html>"


Set myCDONTSMail = CreateObject("CDONTS.NewMail")
set meumail = CreateObject("CDONTS.NewMail")

meumail.bodyformat=0
meumail.mailformat=0
mycdontsmail.mailformat=0
mycdontsmail.bodyformat=0

myCDONTSMail.Send strFrom,strto,strSubject2,strBody


recs.movenext
loop

meumail.Send strFrom,"(e-mail address removed)",strSubject2,strBody2



Set myCDONTSMail = Nothing
Set meumail=nothing

myConnection.Execute mySQL

myConnection.Close


Set myConnection = Nothing
%>


in the meumail.send statement

i can´t figure why..
 
S

Steve Easton

When you dimension your variables you need to identify the variable type.
All of yours will wind up as variants.
Since you have not dimensioned myConnection as an object, the line:
Set myConnection = Server.CreateObject("ADODB.Connection")

will throw an error

Use:
Dim meumail As String
Dim myConnString as Object

and so forth.

--
Steve Easton
Microsoft MVP FrontPage
FP Cleaner
http://www.95isalive.com/fixes/fpclean.htm
Hit Me FP
http://www.95isalive.com/fixes/HitMeFP.htm
 
D

David Berry

What line is the error on? It looks like the problem is in you SQL
Statement. When you do a Response.Write follow it with a Response.End so it
stops processing code and you can see what it's writing out as a SQL
Statement.
 
D

David Berry

That's not necessary with ASP. This syntax is correct

Set myConnection = Server.CreateObject("ADODB.Connection")

I think you're thinking of VB or VBA code.
 
S

Stefan B Rusynko

See http://classicasp.aspfaq.com/general/why-do-i-get-the-error-object-required.html

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| Microsoft VBScript runtime error '800a01a8'
|
| Object required: ''
|
| this is the error i get with this code
|
|
|
| <%
| Dim meumail
| Dim myCDONTSMail
| Dim strFrom
| Dim strTo
| Dim strSubject
| Dim strBody
| Dim strparamim
| Dim strSubject2
| Dim strBody2
|
| Dim myConnString
| Dim myConnection
| Dim mySQL
| dim id
|
| strFrom="(e-mail address removed)"
|
| strSubject2="Alteração de disponibilidade"
| strBody2="Alteracao"
|
| id=request.form("id")
|
| myConnString = Application("basededados1_ConnectionString")
|
|
| Set myConnection = Server.CreateObject("ADODB.Connection")
|
|
| myConnection.Open myConnString
|
|
| mySQL= "DELETE prereserva.* FROM prereserva WHERE id="
|
| mySQL=mySQL & request.form("id")
| mySQL=mySQL & " And situacao='Aguarda confirmação com envio de sinal de
| 30%'"
|
| Response.Write(mysql)
|
|
| set recs=Server.CreateObject("ADODB.recordset")
| recs.Open "SELECT prereserva.* FROM prereserva WHERE id="& id & "And
| situacao='Aguarda confirmação com envio de sinal de 30%'", myConnString
|
|
|
| do while not recs.eof
| strTo=recs.Fields.Item("email")
| strSubject = "Pré reserva " & recs.Fields.Item("n_prereserva")& " foi
| suplantada "
|
| strBody = "<html>"
| strBody = strBody & "<head></head>"
| strBody = strBody & "<body>"
| strBody = strBody & Chr(13) & "A sua prereserva foi suplantada"
|
| strBody = strBody & Chr(13) & "Obrigado.Esperamos que o nosso serviço vá de
| encontro ás suas expectativas."
| strBody = strBody & "</body>"
|
| strBody = strBody & "</html>"
|
|
| Set myCDONTSMail = CreateObject("CDONTS.NewMail")
| set meumail = CreateObject("CDONTS.NewMail")
|
| meumail.bodyformat=0
| meumail.mailformat=0
| mycdontsmail.mailformat=0
| mycdontsmail.bodyformat=0
|
| myCDONTSMail.Send strFrom,strto,strSubject2,strBody
|
|
| recs.movenext
| loop
|
| meumail.Send strFrom,"(e-mail address removed)",strSubject2,strBody2
|
|
|
| Set myCDONTSMail = Nothing
| Set meumail=nothing
|
| myConnection.Execute mySQL
|
| myConnection.Close
|
|
| Set myConnection = Nothing
| %>
|
|
| in the meumail.send statement
|
| i can´t figure why..
|
|
 
L

led

it´s ok now.
before i set the cdonts object inside a recordset loop and use outside . i
just define after the loop and it works fine.

thanks anyway
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top