I've got a button on my Access form which when i click loads a new
message in outlook.
I have got this to work on a number of forms. However it doesnt work on
on particular form in the database. And i cant understand why. It
deosnt make sense to me. When i click the button on this form i get a
Compile error - variable not defined. And it heighlights SW_SHOWNORMAL.
I have this in a module...
Public Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal
lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As
String, ByVal nShowCmd As Long) As Long
Here is the button code...
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
Dim stext As String
Dim sAddedtext As String
If Len(cbemail) Then
stext = cbemail.Column(0)
End If
stext = "mailto:" & stext
If Len(sAddedtext) <> 0 Then
Mid$(sAddedtext, 1, 1) = "?"
End If
stext = stext & sAddedtext
' launch default e-mail program
If Len(stext) Then
Call ShellExecute(hwnd, "open", stext, vbNullString,
vbNullString, SW_SHOWNORMAL)
End If
Exit_Command0_Click:
Exit Sub
Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
End Sub
Please help someone. It doesnt seem logical to me that it works fine on
other forms but not this one.
Thanks in advance.