This topic is locked

'get value' from Drop List?

8/15/2006 3:16:51 AM
ASPRunnerPro General questions
C
ChrisC author

I have a drop list containing 2 Statuses - 'PASS' and 'FAIL'
I'm wanting in "Function BeforeEdit" to test for a selection/value change against the retrieved record set and set a timestamp value when the list value changes.
I had 'hoped' to be able to use the associated field value dict("TEST_PASS_FAIL") but alas I discover drop lists are more complicated and from all my reading of the forum, can not determine how to 'get value from drop list' after selection.
Any guidance appreciated.
Chris

J
Jane 8/15/2006

Chris,
you need something like this:

Function BeforeEdit(dict, where)

str = "select * from TableName where " & where

Set rsTemp = server.CreateObject("ADODB.Recordset")

rsTemp.open str, dbConnection
if dict("TEST_PASS_FAIL")<>rsTemp("TEST_PASS_FAIL") then

dict("timestamp")=Now()

end if
BeforeEdit = True
End Function



where TableName is your actual table name, timestamp is your actual field name where timestamp is stored.

C
ChrisC author 8/15/2006

Chris,

you need something like this:
where TableName is your actual table name, timestamp is your actual field name where timestamp is stored.


Hi Jane
Thanks for your reply.
My original code is in fact exactly as you've suggested to me but I've learnt/am experiencing that the drop list does NOT assign the selected value to dict("TEST_PASS_FAIL") the first time a value is set. Eg.: when the DB record has TEST_PASS_FAIL value = Null.
I've been displaying dict("TEST_PASS_FAIL") values in debug messages throughout the code to ensure my assumption is correct and hence note the behaviour of this 1st selection.
Any suggestions why this might be happening?
Chris

J
Jane 8/16/2006

Chris,
try to use following code:

Function BeforeEdit(dict, where)

str = "select * from TableName where " & where

Set rsTemp = server.CreateObject("ADODB.Recordset")

rsTemp.open str, dbConnection
if dict("TEST_PASS_FAIL")<>rsTemp("TEST_PASS_FAIL") or isnull(rsTemp("TEST_PASS_FAIL")) then

dict("timestamp")=Now()

end if
BeforeEdit = True
End Function