This topic is locked

Select multiple values from a list field

11/10/2009 9:29:50 AM
ASPRunnerPro General questions
L
lnemer author

I need to select multiple values from a list field and have them appear as individual database entries.
The code below is not working and gives this error upon pushing the "SAVE" button: "An unhandled exception ("Object required: 'arr") occurred in w3wp.exe"
Used on event "Add page: Before Record Added":



Dim arr

if values("LOOKUP_EQUIPMENT_ID")<>"" then

arr = Split(values("LOOKUP_EQUIPMENT_ID"),",")

' This is the name of the multi check box or

' list select field, its value becomes $arr

for i=0 to arr.Count

strInsert = "insert into TableName (LOOKUP_EQUIPMENT_ID,HULL_SURVEY_NO) values ('" & arr(i) & "') &',Select_Hull_Survey_No"

dbConnection.Execute strInsert

next

Response.Redirect "UPGRADES_and_MAINTENANCE_add.asp?mastertable=EQUIPMENT_LIST&masterkey1=" & keys("HULL_SURVEY_NO")
exit function

end if
BeforeAdd(True)


Thank you in advance for your help!

J
Jane 11/10/2009

It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.

C
clig 11/18/2009



I need to select multiple values from a list field and have them appear as individual database entries.
The code below is not working and gives this error upon pushing the "SAVE" button: "An unhandled exception ("Object required: 'arr") occurred in w3wp.exe"
Used on event "Add page: Before Record Added":



Dim arr

if values("LOOKUP_EQUIPMENT_ID")<>"" then

arr = Split(values("LOOKUP_EQUIPMENT_ID"),",")

' This is the name of the multi check box or

' list select field, its value becomes $arr

for i=0 to arr.Count

strInsert = "insert into TableName (LOOKUP_EQUIPMENT_ID,HULL_SURVEY_NO) values ('" & arr(i) & "') &',Select_Hull_Survey_No"

dbConnection.Execute strInsert

next

Response.Redirect "UPGRADES_and_MAINTENANCE_add.asp?mastertable=EQUIPMENT_LIST&masterkey1=" & keys("HULL_SURVEY_NO")
exit function

end if
BeforeAdd(True)


Thank you in advance for your help!


if this is an autogenerated id field in your db I don't think ASP will see it unless you go get it after writing record thus I'm thinking you are getting a null condition object error or your db is complainig about writing the string 'value of arr' when arr is a number field... Also what is: &',Select_Hull_Survey_No" off the top looks like a formatting error