This topic is locked

Open outlook after add

11/5/2007 2:57:46 PM
ASPRunnerPro General questions
S
stealthwifi author

Hello,
I would like Outlook to open with data that has been entered when you press submit/save on the form. Similar to this before edit event code:
[codebox]str = "select * from table where ID = " & Request("editid1")

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

rsTemp.open str, dbConnection

Response.write "<a href=""mailto:" & dict("Email") & "?subject=Yoursubject&body=yourbody "">Click to send record info!</a>"[/codebox]
I have tried many times and can not seem to get it running.
Is there a way to have the mailto: automaticy open after you add a record and use the info from the form you are submiting to fill in the email and subject...?

Sergey Kornilov admin 11/5/2007

Opening Outlook automatically is not possible. Just imagine all those spammy websites launching your outlook when you visit them.

S
stealthwifi author 11/6/2007

Good point
Is it possible to have a link/button for the mailto on the add page so after you add your data you can press email and then submit the data?

Sergey Kornilov admin 11/6/2007

Yes, it's possible.
Your code should work.

S
stealthwifi author 11/6/2007

I tried to set it up on the add page so after you type in the data into the form you can press email, then submit the data for the DB and i am getting an error:
This is on the AddOnLoad event and only occurs when clicking Add to get to the Add screen.
Error number -2147217900

Error description [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '='.

URL /Dispatch_add.asp
The code is:

[codebox]str = "select * from Dispatch where DispatchID = " & Request("addid1")

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

rsTemp.open str, dbConnection

Response.write "<a href=""mailto:" & dict("Employee") & "?subject=Yoursubject&body=yourbody "">Click to send record info!</a>"[/codebox]
any idea where the error is generating from?

Sergey Kornilov admin 11/6/2007

There is no such thing as Request("addid1").
I recommend you to check the following article:

http://www.xlinesoft.com/asprunner/docs/pa...le_overview.htm
This can help you pick correct event for this purpose.

S
stealthwifi author 11/6/2007

<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=23075&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' /> Ok Sergey thank's for pointing me in the right direction!
I think i have a better understanding now.
Basicly i want to put

[codebox]Response.write "<a href=""mailto:" & rs("Employee") & "?subject=Yoursubject&body=yourbody "">Click to send record info!</a>"[/codebox]
(not necesairly that exact code)
On the add page for the convience of my users. I'm thinking the Response.Write <a href...... is good upto the rs("Employee"). Since there is no recordset it being the add page i'm looking for a way to pull the field data and throw it in outlook. Is there a way other than rs("field") to grab the data?
I just tried value_Employee inplace of rs("Employee") and the mailto works it just has that field blank

Sergey Kornilov admin 11/7/2007

Use AfterAdd event that have everything you need.

S
stealthwifi author 11/7/2007

Use AfterAdd event that have everything you need.


Worked Great Thanks!
I do have another small problum, when having the Subject & body be a variable i get a "Expected end of statement" error pointing at the " before >Click to send record info!</a>"
The full code is:
Response.write "<a href=""mailto:" & Dict("Employee") & "?subject=Account:"& Dict("Client")& "&body=test " & Dict("Instruct")">Click to send record info!</a>"
The number of "" seems even any idea whats throwing this error?

S
stealthwifi author 11/7/2007

All fixed proper syntax is:
[codebox]Response.write "<a href=""mailto:"& Dict("Employee")& "?subject=Account:"& Dict("Client")& "&body=test "& Dict("Instruct")& """>Click to send record info!</a>"[/codebox]
Thanks for your help!