Below is how I did mine. I do save the document, but it is deleted when I am done with it. When the agent is done it redirects them to a Thank you page in the db. Not exactly what you asked for, but it works. Instead of doing the email, you can just plug in your ODBC code. -- Scott Johnson I put a "Submit" button on my form with no formula or LotusScript. In the WebQuerySave event for the Form I have: @Command([ToolsRunMacro]; "SubmitReq") The SubmitReq agent is made up of the following: Option Public Option Explicit Dim nLog As NotesLog Dim SendTo(1 To 15) As String Sub Initialize Dim session As NotesSession Set session = New NotesSession Dim doc As NotesDocument Set doc = session.DocumentContext Call SendEmail(doc) End Sub Sub SendEmail(doc As NotesDocument) On Error Goto Errors Dim sess As New NotesSession Dim curdb As NotesDatabase Dim mailDoc As NotesDocument Dim rtItem As NotesRichTextItem Dim richstyle As NotesRichTextStyle Dim success As Integer Set curdb = sess.CurrentDatabase Set richstyle = sess.CreateRichTextStyle richstyle.NotesColor = COLOR_BLACK richstyle.NotesFont = FONT_HELV richstyle.FontSize = 10 richstyle.Bold = False SendTo(1) = "firstname.lastname@example.org" Set mailDoc = curdb.CreateDocument mailDoc.Form = "Memo" mailDoc.SendTo = SendTo mailDoc.From = "email@example.com" mailDoc.ReplyTo = "firstname.lastname@example.org" mailDoc.Subject = "Review New Apps Dev Request" Set rtitem = New NotesRichTextItem(mailDoc,"Body") Call rtitem.AppendStyle(richstyle) Set rtItem = mailDoc.CreateRichTextItem("Body") success = doc.RenderToRTItem( rtitem ) Call mailDoc.Send(False) If success Then Call doc.Remove(True) End If Exit Sub Errors: Dim ErrMsg As String ErrMsg = "Agent: AppsDevReq" &Chr(10) & "Func: SendEmail" &Chr(10) & _ "Error number " & Err & " occurred at line number " & Erl & " due to " & Error(Err) Call nLog.LogAction(ErrMsg) Exit Sub End Sub Sub Terminate Print "[http://333.333.333.333/AppsDevReqDb.nsf/ThnksPage?OpenPage]" End Sub
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.