This topic is locked

events works in beforeAdd but not beforeEdit

12/4/2006 9:39:00 PM
ASPRunnerPro General questions
S
SteveL author

Hi there.. so I have the following event in one of my tables to send an automatic email based on a few criterias. This even works fine in the Add page but not the edit page.

here is my code in the before edit page

------

Function BeforeEdit(dict, where)
'generate and send automatic email

if dict("Received")="Yes" and dict("EmailSent") = "No" then

message =""
keys = dict.keys

For n = 0 To dict.Count-1

message = message & keys(n) & " : " & dict(keys(n)) & vbcrlf

Next
email="steve@networkcar.com"

subject="New data record TEST TEST"
sendmail email, subject, message

dict("EmailSent")="Yes"
end if
if dict("Shipped")="Yes" and dict("EmailSent2") = "No" then

message =""
keys = dict.keys

For n = 0 To dict.Count-1

message = message & keys(n) & " : " & dict(keys(n)) & vbcrlf

Next
email="steve@networkcar.com"

subject="New data record TEST TEST"
sendmail email, subject, message

dict("EmailSent2")="Yes"
end if
BeforeEdit = True
End Function
-----------------------

So I have EmailSent and EmailSent2 default to "No" in the add page. When I go to the edit page and change

Received and Shipped to Yes I get the following error

-----------------

The page cannot be displayed

There is a problem with the page you are trying to reach and it cannot be displayed.
--------------------------------------------------------------------------------
Please try the following:
Click the Refresh button, or try again later.
Open the 168.143.116.20 home page, and then look for links to the information you want.

HTTP 500.100 - Internal Server Error - ASP error

Internet Information Services
--------------------------------------------------------------------------------
Technical Information (for support personnel)
Error Type:

Microsoft VBScript runtime (0x800A000D)

Type mismatch: '[string: "Rec#"]'

/include/commonfunctions.asp, line 8815
Browser Type:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Page:

POST 6360 bytes to /RAUnitsReturned_edit.asp
POST Data:

error '80020009'

Exception occurred.
/iisHelp/common/500-100.asp, line 223

---------------------------------
The record acutally still updates and the EmailSent fields get changed to "Yes"

Also I did notice that after this error I can go back and edit that record with out receiving this error anymore. It seems to only occur when EmailSent fields are set to No

Any ideas what is casuing this?
Thanks
-Steve

J
Jane 12/5/2006

Steve,
what field type do you use for the Received and EmailSent field in your database?

S
SteveL author 12/5/2006

Steve,

what field type do you use for the Received and EmailSent field in your database?


they are just text fields.

Sergey Kornilov admin 12/5/2006

Steve,
send me your files and everything I might need (database, project files) and I'll take a look.