C
|
clig 3/22/2007 |
Hi, I am trying to redirect after adding a new record to the view page and passing the ID of that new record so its visible in the view page. I have tried everything I can think of. Any help would be great. Rgds Dale
|
J
|
Jane 3/23/2007 |
Hi, Sub AfterAdd() str = "select max(IDField) from "TableName" Set rsTemp = server.CreateObject("ADODB.Recordset") rsTemp.open str, dbConnection '** Redirect to another page **** Response.Redirect "TableName_view.asp?editid1=" & rsTemp(0) rsTemp.Close : set rsTemp = Nothing End Sub
|
D
|
dlangham author 3/23/2007 |
Hi, you can do it using AfterAdd event on the Events tab. Here is a sample code: where IDField is your primary key, TableName is your actual table name.
Sub AfterAdd() |
J
|
Jane 3/23/2007 |
Dale, Sub AfterAdd() str = "select max([Reference Number]) from [Main Table]" Set rsTemp = server.CreateObject("ADODB.Recordset") rsTemp.open str, dbConnection '** Redirect to another page **** Response.Redirect "Main_Table_view.asp?editid1=" & rsTemp(0) rsTemp.Close : set rsTemp = Nothing End Sub |
D
|
dlangham author 3/23/2007 |
Thank you Jane, |