E-mail address in an Access table

A

Amateur

Dear Sirs
I have a table with all customer data as well as his e-mail address.

I would like that, by clicking on the e-mail address, Outlook opens with the
e-mail address already filled in.
Is that possible?
Thanks for any help
Klaus
 
A

Arvin Meyer [MVP]

Use the double-click event. Do not use the Hyperlink datatype for the email
address because it leads to problems. Use a text datatype instead. Here's
some code:

Private Sub txtBoxName_DblClick(Cancel As Integer)
On Error Resume Next
Dim strEmail As String
If Not IsNull(Me.txtBoxName) Then
strEmail = Me.txtBoxName
DoCmd.SendObject acSendNoObject, , , strEmail
End If
End Sub
 
A

Amateur

Hello again,

How shall I enter your piece of code in my table field properties? And where?
Regards
Klaus
 
A

Amateur

Stupid me - OK I got your message, understood

Arvin Meyer said:
Use the double-click event. Do not use the Hyperlink datatype for the email
address because it leads to problems. Use a text datatype instead. Here's
some code:

Private Sub txtBoxName_DblClick(Cancel As Integer)
On Error Resume Next
Dim strEmail As String
If Not IsNull(Me.txtBoxName) Then
strEmail = Me.txtBoxName
DoCmd.SendObject acSendNoObject, , , strEmail
End If
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
A

Amateur

OK, works - but one more thing - How can the cursor shows a hand if he moves
over the e-mail address?

Thanks Klaus
 
A

Arvin Meyer [MVP]

You shouldn't need to for a double-click event, but you can use an api.
Here's some code to put in a standard module:

Declare Function LoadCursorFromFile Lib "User32" Alias _
"LoadCursorFromFileA" (ByVal lpFileName As String) As Long

Declare Function SetCursor Lib "User32" _
(ByVal hCursor As Long) As Long

Public Function HandPoint()
Dim lngRet As Long
lngRet = LoadCursorFromFile("C:\Windows\Cursors\harrow.cur")
lngRet = SetCursor(lngRet)
End Function

The path to the hand cursor is here on my machine, so you will need to
possible change your code from:

("C:\Windows\Cursors\harrow.cur")

to your cursor path.

In the MouseOver event on the property sheet, put:

=HandPoint()

That's it.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
A

Amateur

Hi Arvin

I receive the error message: End of statement expected in this part
Declare Function LoadCursorFromFile Lib "User32" Alias _
"LoadCursorFromFileA" (ByVal lpFileName As String) As Long
Can you tell me what I'm doing wrong.
Regards
Klaus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top