This topic is locked

old event codes dont work in 4.1

11/3/2006 1:44:05 PM
ASPRunnerPro General questions
S
SteveL author

I guess all of my old event codes from 4.0 no longer work in 4.1

here is another code where I generate a textfile with each record saved.
-------------

Function BeforeEdit(dict, where)
' Parameters:

' dict - Scripting.Dictionary object.

' Each field on the Add form represented as 'Field name'-'Field value' pair
CRSNfield = "CRSN: " & rs("CarReaderSerialNum")

MBNfield = "Motherboard: " & rs("MotherboardNum")

SIMfield = "SIM: " & rs("SIMCardNum")

IMEIfield = "IMEI: " & rs("IMEI")

MSNfield = "MSN: " & rs("MSN")

Netfield = "Network: " & rs("Network")

TesterIDfield = "TesterID: " & dict("TesterID")

Phonefield = "PhoneNum: " & rs("PhoneNum")

Gatewayfield = "Gateway: " & rs("Gateway")

APNfield = "APN: " & rs("APN")

Userfield = "User: " & rs("User")

Passfield = "Password: " & rs("Password")
message = CRSNfield & vbcrlf & MBNfield & vbcrlf & SIMfield & vbcrlf & Netfield & vbcrlf & IMEIfield & vbcrlf & MSNfield & vbcrlf & TesterIDfield & vbcrlf

messageb = Phonefield & vbcrlf & Gatewayfield & vbcrlf & APNfield & vbcrlf & Userfield & vbcrlf & Passfield & vbcrlf

message = message & messageb
Const ForReading = 1, ForWriting = 2, ForAppending = 8

Dim fso, f

Set fso = CreateObject("Scripting.FileSystemObject")

Set f = fso.OpenTextFile("\\Fileserver2\public\Manufacturing\TestingFiles\"+dict("TesterID")+".txt",ForWriting, True)

f.Write message

f.Close
dict("DateTested") = Now()

dict("Tester") = Session("UserID")
BeforeEdit = True
End Function
-----------------
I now get this error after saving
ASP error happened
Technical information

Error number 3265

Error description Item cannot be found in the collection corresponding to the requested name or ordinal.

URL /GPRSFirstAssembly_Query_edit.asp

SQL query select from [GPRSFirstAssembly Query] where [GPRSFirstAssembly Query].[CarReaderSerialNum]='013400226735'

Solution There are no records in the recordset.
Please edit your event code in the following way:
strSQL = "select
from AnyTable where AnyColumn='AnyValue'"
set rsTemp = CreateObject("ADODB.Recordset")
rsTemp.Open strSQLExists, dbConnection
and then use rsTemp("fieldname").
Or you can contact to support@xlinesoft.com and send your event code. We'll help you.
More info on this error

Sergey Kornilov admin 11/4/2006

This event code is not correct.
Instead of using recordset variables rs("field1"), rs("field2") you need to use dict("field1"), dict("field2"). This method works in both ASPRunnerPro 4.0 and 4.1.