error '80020009' Exception occurred

P

psaban

Getting an exception occurred error with the following code:


Dim rgstcustConnect 'as Connection

set rgstcustConnect=server.createobject("adodb.connection")
rgstcustConnect.open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source="c:\devweb\_private\cust.mdb"

DeleteExistingEmailSql = "DELETE *" & _
" FROM telecoms" & _
" WHERE (((telecoms.NumberType)='') AND (telecoms.Number) Like
'%@%') AND ((telecoms.CustomerNumber)=" & customernumber & ")) OR
(((telecoms.NumberType)='Email') AND ((telecoms.CustomerNumber)=" &
customernumber & "))"

set intelecoms=server.createobject("adodb.recordset")
intelecoms.open DeleteExistingEmailSql, rgstcustConnect,
adopenstatic, adlockoptimistic

AddEmailSql = "INSERT INTO telecoms (CustomerNumber, [Number],
NumberType, PrimaryEmail)" & _ ' Error occurs on this line
" VALUES (" & customernumber & ", '" &
request.form("email") & "', 'Email', True)"

set intelecoms=server.createobject("adodb.recordset")
intelecoms.open AddEmailSql, rgstcustConnect, adopenstatic,
adlockoptimistic

Either query executed on its own works fine, but as soon I try to
delete any existing emails for the current customernumber and then add
the new email supplied I get the exception error.

Any help is appreciated.
 

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

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top