This topic is locked

Move a record from table to another.

7/23/2007 11:29:48 AM
ASPRunnerPro General questions
J
Justy author

Hi,
I am trying to move a record from one table to another using events.

  1. Insert into
  2. Delete from
    These options are triggered from the edit page and the event BEFORE RECORD UPDATE.
    The insert into is sussed. I am having trouble with the delete from.
    I receive the following error :

    ASP error happened
    Technical information

    Error number 424

    Error description Object required

    URL /delivery/qry_book_out_edit.asp

    SQL query select * from [qry_book_out] where ([qry_book_out].[recid]=1) and ([qry_book_out].[currdepot]='101')

    Solution Please contact us at support@xlinesoft.com and send detailed description of what you doing or your event code.
    Here is my event code :
    Function BeforeEdit(dict, where)
    ' Parameters:

    ' dict - Scripting.Dictionary object.

    ' Each field on the Edit form represented as 'Field name'-'Field value' pair

    ' where - string with WHERE clause pointing to record to be edited
    '** Insert a record into another table ****

    strSQLInsert = "insert into tbl_intransit (newused, model, deliveredfrom, regstkchassis, radiocode, keyno, comments) values ('"& dict("newused") & "','" & dict("model") & "','" & dict("deliveredfrom") & "','" & dict("regstkchassis") & "','" & dict("radiocode") & "','" & dict("keyno") & "','" & dict("comments") & "')"

    dbConnection.Execute strSQLInsert
    '** Insert a record into another table ****

    strSQLInsert = "insert into tbl_transaction (regchassis, inout) values ('" & dict("regstkchassis") & "','" & "OUT on " & now() & " to " & Session("UserID")& "')"

    dbConnection.Execute strSQLInsert
    '** Insert a record into another table ****

    strSQLDelete = "delete from tbl_detail where (" & tbl_detail.regstkchassis & "=" & dict("regstkchassis")& ")"

    dbConnection.Execute strSQLInsert
    '** Redirect to another page ****

    Response.Redirect "qry_book_out_list.asp"
    BeforeEdit = true
    ' set BeforeEdit to True if you like to proceed with editing this record

    ' set it to False in other case
    End Function
    Can you help ?
    Regards,
    Justin.

Sergey Kornilov admin 7/23/2007

Answered to your personal email

J
Justy author 7/26/2007

Sergey,
Thanks for the reply.
The following is for anybody having the same trouble.
Correct code:

strSQLDelete = "delete from tbl_detail where regstkchassis='" & GetRequestForm("value_regstkchassis") & "'"

dbConnection.Execute strSQLDelete
Regards,
Justin