Hello,
I created Data Access Page and put one command button to send an email when the table has been updated. I continued getting an error.
The button that I put on the page was to save the record and send an email notification. I call it, "SaveandSent."
The script that I have behind the button is the following: (The button name is "SaveandSent.")
The scripts are below:
<SCRIPT language=javascript event=onclick for=SaveandSent>
try { if (MSODSC.DataPages.Count > 0)
if (MSODSC.CurrentSection == null)
MSODSC.DataPages(0).Save();
else
MSODSC.CurrentSection.DataPage.Save(); }
catch (e)
{ alert (e.description);}
const olMailItem = 0
Dim oApp 'As New Outlook.Application
Dim oMail 'As Outlook.MailItem
Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItem(olMailItem)
oMail.To = ("My Email@mydomain.com")
oMail.Subject = ("Record has been updatedl")
oMail.Body = ("The table has been updated with a new record.")
oMail.Save
oMail.Send
</SCRIPT>
When I saved the scripts in vbs file, it was running fine. I am using Outlook as my mail application and running Access 2003.
Can anyone please let me know why I still have problem with this code in the Data Access Page? If I forget any semi-colon or period or brackets, please post them as well. Thank you for your help.
I created Data Access Page and put one command button to send an email when the table has been updated. I continued getting an error.
The button that I put on the page was to save the record and send an email notification. I call it, "SaveandSent."
The script that I have behind the button is the following: (The button name is "SaveandSent.")
The scripts are below:
<SCRIPT language=javascript event=onclick for=SaveandSent>
try { if (MSODSC.DataPages.Count > 0)
if (MSODSC.CurrentSection == null)
MSODSC.DataPages(0).Save();
else
MSODSC.CurrentSection.DataPage.Save(); }
catch (e)
{ alert (e.description);}
const olMailItem = 0
Dim oApp 'As New Outlook.Application
Dim oMail 'As Outlook.MailItem
Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItem(olMailItem)
oMail.To = ("My Email@mydomain.com")
oMail.Subject = ("Record has been updatedl")
oMail.Body = ("The table has been updated with a new record.")
oMail.Save
oMail.Send
</SCRIPT>
When I saved the scripts in vbs file, it was running fine. I am using Outlook as my mail application and running Access 2003.
Can anyone please let me know why I still have problem with this code in the Data Access Page? If I forget any semi-colon or period or brackets, please post them as well. Thank you for your help.