I am using Access 2000 and I have created a Telephone Directory to use over the LAN. I made a data access page, because everyone doesn't have Access installed on their computers. I am now trying to put in a button that will open Outlook from my access page, and possibly insert information from the database into Outlook. I have two codes that I have been working on and both have been giving me scripting errors. I know that if I was using a form I need to put a statement in OnCLick properties of my command button, but in the data access page it doesn't give me that option. I tried to putting the code on the OnMouseEnter but with no avail. I have a command button ("Object:RunOutlook" with the properties: Name - RunOutlook and Value - Start Outlook. Here is my first code:
[\code]
<SCRIPT language=vbscript event=onclick for=RunOutlook>
<!--
Private Sub cmdRunOutlook_Click
On error GoTo HandleErr
'Save the Record
If Me.Dirty then DoCmd.RunCommand ac CmdSaveRecord
'Make sure the hyperlink property is current
EnableEmail
Exithere:
Exit Sub
HandleErr:
Select Case Err
Case Else
MsgBox Err & ": " & Err.Description, _, "Page_PhoneDirectoryByLastName.cmdEmailContact_Click"
End Select
Resume ExitHere
-->
</SCRIPT>
[\code]
<SCRIPT language=vbscript event=onclick for=RunOutlook>
<!--
Private Sub cmdRunOutlook_Click
On error GoTo HandleErr
'Save the Record
If Me.Dirty then DoCmd.RunCommand ac CmdSaveRecord
'Make sure the hyperlink property is current
EnableEmail
Exithere:
Exit Sub
HandleErr:
Select Case Err
Case Else
MsgBox Err & ": " & Err.Description, _, "Page_PhoneDirectoryByLastName.cmdEmailContact_Click"
End Select
Resume ExitHere
-->
</SCRIPT>
Code:
Do I need to add something else to my properties or is my code on the wrong track?? Should I be using objects or something? This is the code I tried to manipulate into the OnMouseEnter event:
[\code]
<SCRIPT language=vbscript event=onmouseenter for=RunOutlook>
<!--
Public Function StartOutLook()
On Error GoTo StartOutLook_Error
Dim spObj As Object, MyItem As Object
' Create a Microsoft OutLook object.
Set spObj = CreateObject("Outlook.Application")
' Create and open new contact form for input.
Set MyItem = spObj.CreateItem(olContactItem)
MyItem.Display
' Quit Microsoft Outlook.
Set spObj = Nothing
Exit Function
StartOutLook_Error:
MsgBox "Error: " & Err & " " & Error
Exit Function
End Function
-->
</SCRIPT>
[code]
I also have the Microsoft Outlook 9.0 Object Library loaded. I am not really looking for a full coded answer, but if anyone can give me some direction I would be very grateful. I am about to give up on this project all together. Thank you,
L.H.