Hi,
I am totally stuck on a problem and cannot find any help or guidance on this subject for access 2003. I need to attach a file to an email via access 2003. I have a module installed to browse the file on pc's harddrive and this populates a text box with the file name. When clicking the email function i need the file to be added as an attachment to the email.
Is this possible ? Anyone know. The file is not an access report /form / query etc and is already in .pdf format so doesnt need converting or anything else.
Code for the browse is
Private Const VER_PLATFORM_WIN32_NT = 2
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" _
(ByRef lpVersionInformation As OSVERSIONINFO) As Long
Private Declare Function GetFileNameFromBrowseW Lib "shell32" Alias "#63" _
(ByVal hwndOwner As Long, _
ByVal lpstrFile As Long, _
ByVal nMaxFile As Long, _
ByVal lpstrInitialDir As Long, _
ByVal lpstrDefExt As Long, _
ByVal lpstrFilter As Long, _
ByVal lpstrTitle As Long) As Long
Private Declare Function GetFileNameFromBrowseA Lib "shell32" Alias "#63" _
(ByVal hwndOwner As Long, _
ByVal lpstrFile As String, _
ByVal nMaxFile As Long, _
ByVal lpstrInitialDir As String, _
ByVal lpstrDefExt As String, _
ByVal lpstrFilter As String, _
ByVal lpstrTitle As String) As Long
Public Function BrowseFiles()
Dim sSave As String
sSave = Space(255)
'If we're on WinNT, call the unicode version of the function
If IsWinNT Then
GetFileNameFromBrowseW Screen.ActiveForm.Hwnd, _
StrPtr(sSave), _
255, _
StrPtr("c:\"), _
StrPtr("txt"), _
StrPtr("Text files (*.txt)" + Chr$(0) + "*.txt" + Chr$(0) + _
"All files (*.*)" + Chr$(0) + "*.*" + Chr$(0)), _
StrPtr("The Title")
'If we're not on WinNT, call the ANSI version of the function
Else
GetFileNameFromBrowseA Screen.ActiveForm.Hwnd, _
sSave, _
255, _
"c:\", _
"txt", _
"All files (*.*)" + Chr$(0) + "*.*" + Chr$(0) + _
"Text files (*.txt)" + Chr$(0) + "*.txt" + Chr$(0), _
"The Title"
End If
BrowseFiles = Trim(Replace(sSave, Chr$(0), " "))
End Function
Public Function IsWinNT() As Boolean
Dim myOS As OSVERSIONINFO
myOS.dwOSVersionInfoSize = Len(myOS)
GetVersionEx myOS
IsWinNT = (myOS.dwPlatformId = VER_PLATFORM_WIN32_NT)
End Function
And the code is email is
Private Sub Email_Click()
On Error GoTo Err_email_Click
Dim stSubject As String
Dim stServert As Variant
Dim errLoop As Error
Dim stproblem As String
Dim StDescription As Variant
Dim StproblAs String
Dim StDATE As Variant
Dim STTIME As Variant
Dim Stprob2 As Variant
Dim stAR As Variant
stSubject = "Request for Support"
stServer = Me.Combo2
Stprob = Me.Combo4
StDescription = Me.Description
Stprob1 = Me.prob1
stAR = Me.Text9
StDATE = Me.DATE
STTIME = Me.Text32
stAnomaly = "Dear Sir(s)," & Chr$(13) & _
"Please be informed that at " & StDATE & "_" & STTIME & " Time" & Chr$(13) & _
"a problem was detected on the " & stServer & " " & Chr$(13) & _
"Intial investigations point to a Server Anomaly of " & Stproblem & StDescription & Stprob & Chr$(13) & _
"AR " & stAR & " was raised" & Chr$(13) & _
"A description of the problem is provided in the attached pages. We request your support as defined in blah blah and we wait for your inputs before any further action is taken with the " & stproblem & " problems."
DoCmd.SendObject , , , jannerman33@hotmail.com, , , "Request for help" & stShelp, stproblem
Exit_email_Click:
Exit Sub
Err_email_Click:
MsgBox Err.Description
Resume Exit_email_Click
End Sub
Any help would be greatly appreciated
I am totally stuck on a problem and cannot find any help or guidance on this subject for access 2003. I need to attach a file to an email via access 2003. I have a module installed to browse the file on pc's harddrive and this populates a text box with the file name. When clicking the email function i need the file to be added as an attachment to the email.
Is this possible ? Anyone know. The file is not an access report /form / query etc and is already in .pdf format so doesnt need converting or anything else.
Code for the browse is
Private Const VER_PLATFORM_WIN32_NT = 2
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" _
(ByRef lpVersionInformation As OSVERSIONINFO) As Long
Private Declare Function GetFileNameFromBrowseW Lib "shell32" Alias "#63" _
(ByVal hwndOwner As Long, _
ByVal lpstrFile As Long, _
ByVal nMaxFile As Long, _
ByVal lpstrInitialDir As Long, _
ByVal lpstrDefExt As Long, _
ByVal lpstrFilter As Long, _
ByVal lpstrTitle As Long) As Long
Private Declare Function GetFileNameFromBrowseA Lib "shell32" Alias "#63" _
(ByVal hwndOwner As Long, _
ByVal lpstrFile As String, _
ByVal nMaxFile As Long, _
ByVal lpstrInitialDir As String, _
ByVal lpstrDefExt As String, _
ByVal lpstrFilter As String, _
ByVal lpstrTitle As String) As Long
Public Function BrowseFiles()
Dim sSave As String
sSave = Space(255)
'If we're on WinNT, call the unicode version of the function
If IsWinNT Then
GetFileNameFromBrowseW Screen.ActiveForm.Hwnd, _
StrPtr(sSave), _
255, _
StrPtr("c:\"), _
StrPtr("txt"), _
StrPtr("Text files (*.txt)" + Chr$(0) + "*.txt" + Chr$(0) + _
"All files (*.*)" + Chr$(0) + "*.*" + Chr$(0)), _
StrPtr("The Title")
'If we're not on WinNT, call the ANSI version of the function
Else
GetFileNameFromBrowseA Screen.ActiveForm.Hwnd, _
sSave, _
255, _
"c:\", _
"txt", _
"All files (*.*)" + Chr$(0) + "*.*" + Chr$(0) + _
"Text files (*.txt)" + Chr$(0) + "*.txt" + Chr$(0), _
"The Title"
End If
BrowseFiles = Trim(Replace(sSave, Chr$(0), " "))
End Function
Public Function IsWinNT() As Boolean
Dim myOS As OSVERSIONINFO
myOS.dwOSVersionInfoSize = Len(myOS)
GetVersionEx myOS
IsWinNT = (myOS.dwPlatformId = VER_PLATFORM_WIN32_NT)
End Function
And the code is email is
Private Sub Email_Click()
On Error GoTo Err_email_Click
Dim stSubject As String
Dim stServert As Variant
Dim errLoop As Error
Dim stproblem As String
Dim StDescription As Variant
Dim StproblAs String
Dim StDATE As Variant
Dim STTIME As Variant
Dim Stprob2 As Variant
Dim stAR As Variant
stSubject = "Request for Support"
stServer = Me.Combo2
Stprob = Me.Combo4
StDescription = Me.Description
Stprob1 = Me.prob1
stAR = Me.Text9
StDATE = Me.DATE
STTIME = Me.Text32
stAnomaly = "Dear Sir(s)," & Chr$(13) & _
"Please be informed that at " & StDATE & "_" & STTIME & " Time" & Chr$(13) & _
"a problem was detected on the " & stServer & " " & Chr$(13) & _
"Intial investigations point to a Server Anomaly of " & Stproblem & StDescription & Stprob & Chr$(13) & _
"AR " & stAR & " was raised" & Chr$(13) & _
"A description of the problem is provided in the attached pages. We request your support as defined in blah blah and we wait for your inputs before any further action is taken with the " & stproblem & " problems."
DoCmd.SendObject , , , jannerman33@hotmail.com, , , "Request for help" & stShelp, stproblem
Exit_email_Click:
Exit Sub
Err_email_Click:
MsgBox Err.Description
Resume Exit_email_Click
End Sub
Any help would be greatly appreciated