Home > Archive > MS Access and Internet > December 2005 > Add Email Command Button to Data Access Page









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Add Email Command Button to Data Access Page
jnariss

2005-12-02, 9:46 am

Hello,

For weeks I have been trying to create this website. I now have run into a problem which I can't figure out. I've got this data access page which I want the user to go into and fill out the "Ticekt Form" and then click the "Submit" button and it will email the "Ticekt Report" to one email address.

I have tried all sorts of things using script and nothing seems to work. The final script I tried on the Click() event procedure is:

<SCRIPT language=vbscript event=onclick for=Command0>
<!--
<PRE><FONT size=2 POINT-SIZE="10" NAME="Courier New">Private Sub Command0_Click()
Dim zip_file As String, Ret As Long

<FONT color=#008000>' Start Outlook Express email.</FONT>
zip_file = App.Path & "\test.zip"
ShellExecute Me.hWnd, "Open", _
"mailto:justine.nariss@egseg.com?subject=" & zip_file & _
"&body=Zip File Attached", vbNullString, _
vbNullString, vbNormalFocus

<FONT color=#008000>' Wait until Outlook Express is ready.</FONT>
While Ret = 0
DoEvents
Ret = FindWindow(vbNullStr
ing, zip_file)
Wend

<FONT color=#008000>' Send keys Alt-I-A, the zip file name,</FONT>
<FONT color=#008000>' two TABs, and Enter.</FONT>
SendKeys "%ia" & zip_file & "{TAB}{TAB}{ENTER}"
End Sub</FONT></PRE>
-->
</SCRIPT>

This did not work and all it say was a debugging error on line 145 which is the <!-- line.

I can't figure this out and right now I have tried so many different ways I don't even know how to do it anymore.

I have also tried to make a command button and name it
CmdEmail. Then putting the following code behind the Click():

Private Sub CmdEmail_Click()
On Error Resume Next
'Prevent error screen if user cancels without sending mail.
Dim strToWhom As String
'If user wants to directly send item, get address from form
strToWhom = Me!Email
DoCmd.SendObject acSendDataAccessPage
, "Request Ticket","strToWhom",,,"Request Ticket","Please see the attached file",No

And this was a no go as well.

Does anyone have any idea how to do this? I would be fine with just letting the users go into the database and choosing to fill out the form I created however when I add a link to go to my database it prompts the user to save the database instead of just opening it and filling out the form.

What should I do now? Any help, answers and suggestions would be wonderful and much appreciated.

-Justine
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com