Anj
Posts: 13
|
Posted: 04/26/2010, 9:56 PM |
|
Microsoft VBScript runtime error '800a01a8'
Hey,
In need of some help to get this script working. Any help is greatly appreciated.
I have a list of users which I have sorted into groups to send different emails. The emails are html pages
The error
Microsoft VBScript runtime error '800a01a8'
Object required: '[string: "SELECT UserID, Conta"]'
/Admin/Planning/EmailMarketing_events.asp, line 26
The Code Problem is *
'Get SQL
Dim SQL
Dim oRS
Dim Connection
Dim ErrorMessage
Dim GroupDesc
Set Connection = New clsDBConnection1
Server.CreateObject("ADODB.RecordSet")
* Set GroupDesc = CCDLookUp("GroupSQL", "tblEmailGroup" , "EmailGroupID =" & DBConnection1.ToSQL (tblEmailMarketing1.EmailGroupID.Value, ccsInteger), DBConnection1)
oRS.Open GroupDesc, Connection, 3, 3
ErrorMessage = CCProcessError(Connection)
Connection.Close
Set Connection = Nothing
On Error Goto 0
Do While Not oRS.EOF
' Send Mail
Dim Mail
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "mail.wiks.net.au" ' Required
Mail.Port = 25 ' Optional. Port is 25 by default
Mail.From = "mail@wiks.com.au" ' Required
Mail.FromName = "WIKS - Workplace Improvement Kits" ' Optional
Mail.AddAddress Response.Write(oRS("Email")) , Response.Write(oRS("ContactName"))
Mail.Subject = tblEmailMarketing1.Subject.Value
Mail.Body = tblEmailMarketing1.BodyPage.Value
'Mail.AppendBodyFromFile = tblEmailMarketing1.BodyPage.Value
'Mail.AddToBody = True
On Error Resume Next
Mail.Send
If Err <> 0 Then
Response.Write "An error occurred: " & Err.Description
End If
oRS.MoveNext
Loop
|
|
|
TheunisP
Posts: 342
|
Posted: 04/27/2010, 2:09 AM |
|
I seriously doubt if this line is your error: Set GroupDesc = CCDLookUp("GroupSQL", "tblEmailGroup" , "EmailGroupID =" & DBConnection1.ToSQL (tblEmailMarketing1.EmailGroupID.Value, ccsInteger), DBConnection1)
that lookup will create a SELECT GroupSQL FROM tblEmailGroup WHERE ...
which is nowhere close to
SELECT UserID, Conta ...
|
|
|
Anj
Posts: 13
|
Posted: 04/27/2010, 5:26 AM |
|
The text in the error relates to the text in the field GroupSQL and should say:
SELECT UserID, ContactName, Company, Email, Group, [Training Interest]
FROM UserTable
WHERE (((UserID)=1));
I think I am calling this incorrectly but am not sure what is the right way to go.
|
|
|
datadoit
|
Posted: 04/27/2010, 6:58 AM |
|
May or may not be your issue, but you want to avoid using table/field
names using the word "Group".
|
|
|
Anj
Posts: 13
|
Posted: 04/27/2010, 7:10 AM |
|
Removed "Group" and "[Training Interest]" from SQL and am still having the same problem
|
|
|
Oper
Posts: 1195
|
Posted: 04/27/2010, 7:55 AM |
|
SET
why SET?
also could you run the as check that the erro in line 26 is that cuase error and line are really different.
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
|
|
TheunisP
Posts: 342
|
Posted: 04/27/2010, 10:35 AM |
|
you say that the field GroupSQL contains "SELECT UserID, ContactName, Company, Email, Group, [Training Interest] FROM UserTable WHERE (((UserID)=1));" or is that is a variable containg that statement?
|
|
|
TheunisP
Posts: 342
|
Posted: 04/27/2010, 10:38 AM |
|
let me clarrify my question, you have a table with a field that has SQL statements in it?
|
|
|
TheunisP
Posts: 342
|
Posted: 04/27/2010, 10:41 AM |
|
just noticed another thing: you have a dim inside a loop? That should be before you hit the loop, otherwise that will only add to your problems
|
|
|
Anj
Posts: 13
|
Posted: 04/27/2010, 4:25 PM |
|
Yes I have a table with a field that has SQL statements in it. The table is called tblEmailGroup and the field with the SQL is called GroupSQL.
Just not sure how to get the email to send to all of the people in the group when the user selects the group on the form.
Will move the Dim statement
|
|
|
|