This topic is locked

How to show Record ID in Email

8/18/2006 11:34:19 AM
ASPRunnerPro General questions
B
bburden author

When a new record is added, I have a field that assigned a Record ID automatically. That works great.
My question is - is it possible for that Record ID to show up in an Email?
What I have done to make a Record ID show up in my email, is I added a dropdown box with numbers in it and just select the corrosponding number that matches the Record ID # and that number show up in my email that I placed in the Event beforeadd function.
Thanks for your help.

Sergey Kornilov admin 8/21/2006

You can use AfterAdd event and the following SQL query:

select max(RecordID) from TableName


This SQL query returns an ID of record that was created.

B
bburden author 8/21/2006

Sergey, I tried the below SQL and I got a page can not be displayed. I enclosed my actual sql.
Sub AfterAdd()
select max(tkt_id) from ticket_Table1
End Sub
What I am I doing wrong?

J
Jane 8/21/2006

You need to execute your query and then display the result:

Sub AfterAdd()

str = "select max(tkt_id) as mx from ticket_Table1"

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

rsTemp.open str, dbConnection

Response.Write rsTemp("mx")

End Sub



I recommend you to learn some asp tutorials:

http://www.webcheatsheet.com/asp/

B
bburden author 8/21/2006

Jane, thanks for your help. I have been and is still learing ASP. Thanks for the link.
The code you gave does not work for me. It still does not add the tkt_id number to the email.
Sub AfterAdd()

str = "select max(tkt_id) as mx from ticket_Table1"

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

rsTemp.open str, dbConnection

Response.Write rsTemp("mx")

End Sub