This topic is locked

Before Record Deleted

7/15/2007 12:38:02 PM
ASPRunnerPro General questions
T
telemark author

I have played about with ASP Runner Pro 5.0 and found it to be a fantastic product. If I can get my ideas to work, I am going to buy the product without question. I have solved almost all my problems by either these forums or your tutorials etc - Thanks. At the moment I have one nagging problem that I keep trying to solve. I believe the code look correct but I'm not great at SQL. I have other problems but will solve these after I purchase the product
The problem - When an entry is deleted I wish to copy every field in that entry into another table for archive purposes. My main table is tblfaults with 15 fields, the archive table is tblarchive which is a structure copy of the tblfaults. One field is auto number the others are date/time, text and memo fields. Some of the text fields are linked to other tables for the purpose of combo boxes.
The code I tried for testing was initially to copy one field from the table then move onto every field. The field I chose was ActionBy which is a memo field. The code is below.
[codebox]'** Save old data record in another table ****

strSQLSave = "INSERT INTO tblarchive (ActionBy) SELECT ActionBy FROM " & strTableName & where

dbConnection.Execute strSQLSave
BeforeDelete = True[/codebox]
The fault I get is
[codebox]Error number -2147217900

Error description [Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.

URL /Faultlog/tblfaults_list.asp

SQL query delete from [tblfaults] where [tblfaults].[UFaultID]=1[/codebox]
UFaultID is the primary key field in tblFaults. I know I must have made some stupid error or a simple code problem.
Thanks for looking
Andy

T
telemark author 7/15/2007

I got the code working I missed a part out. code below

[codebox]strSQLSave = "INSERT INTO tblarchive (ActionBy) SELECT ActionBy FROM " & strTableName & " where " & where

dbConnection.Execute strSQLSave
BeforeDelete = True[/codebox]
Hopefully the other field types will be just as easy.
Andy B