CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Redirect to the most recently inserted record

Print topic Send  topic

Author Message
Rosario


Posts: 54
Posted: 01/15/2009, 12:35 AM

I have a MSSQL DB back end and my incremential uniq id is just plain old ID in the table, my other unique identifier is the user called ATTUID. I tried aplying this logic DB name is MSOC and the table name is JOBAID1

LastInsertID = CType((New ID("", Insert.Dao.ExecuteScalar("SELECT
MAX(CRMID) FROM Individuals WHERE Name=" & ATTUID & " ))).Value, Int64)


That didnt work

In plain english I need to:
Let user create a new record, insert that as normal.
Then (AfterInsert) you reget the last inserted record ID and call the
form with that ID which will present that to the user in editmode.

Any Help here would be great!:-D
View profile  Send private message
Rosario


Posts: 54
Posted: 01/15/2009, 6:33 AM

Also using the code from the example pack gave no result to the next page
'Custom Code @17-73254650
' -------------------------
Dim LastID

'Retrieve the last inserted key if a new user is registered
'This method of retrieving the last inserted key is safe because the value of the user_login field has to be unique.
If IsEmpty(Request.QueryString("ID")) Then
LastID = CCDLookup("max(ID)","JOBAID1","ATTUID="&DBMSOC.ToSQL(Request.Form("ATTUID"),"CCText"),DBMSOC)
If InStr(Redirect,"?") = 0 Then
Redirect = Redirect & "?ID=" & LastID
ElseIf Right(Redirect, 1) = "?" Then
Redirect = Redirect & "ID=" & LastID
Else
Redirect = Redirect & "&ID=" & LastID
End If
End IF
'End Custom Code' -------------------------


Dose this look right?
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.