J
JIM
I've been dealing with this problem for over a month and still have not
resolved. I thought my database was corrupted and went thru Allen Browne's
sequence of steps to repair. But I created a new database with the same
situation and it also crashes. The goal is to print a pdf file from access.
Code in my module is:
Option Compare Database
Option Explicit
Public Const SW_Hide = 0
Public Const SW_Minimize = 6
Public Const SW_Restore = 9
Public Const SW_Show = 5
Public Const SW_ShowMazimized = 3
Public Const SW_ShowMinimized = 2
Public Const SW_ShowMinnoActive = 7
Public Const SW_Showna = 8
Public Const SW_ShownoActivate = 4
Public Const SW_ShowNormal = 1
Public Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA"
(ByVal hWnd As Long, ByVal IpOperation As String, ByVal IpParameters As
String, ByVal IpDirectory As String, ByVal nShowCmd As Long) As Long
Public Sub ExecuteFile(sFileName As String, sAction As String) 'sAction can
be either "Open" or "Print"
Dim vReturn As Long
If ShellExecute(Access.hWndAccessApp, sAction, sFileName, vbNullString,
SW_ShowNormal) < 33 Then
MsgBox "File not found"
End If
End Sub
Then from a command button on a form the module is called in this subroutine:
Private Sub Option62_Click()
Dim sFileName As String
sFileName = Me.txtMapLoc
Call ExecuteFile(sFileName, "Print")
End Sub
It causes a message to come that says, "Microsoft Access for Windows has
encountered a problem and needs to close. We are sorry for the
inconvenience."
Is there something wrong with my code or is a library reference missing? I
have the Shell Library checked.
Thanks
resolved. I thought my database was corrupted and went thru Allen Browne's
sequence of steps to repair. But I created a new database with the same
situation and it also crashes. The goal is to print a pdf file from access.
Code in my module is:
Option Compare Database
Option Explicit
Public Const SW_Hide = 0
Public Const SW_Minimize = 6
Public Const SW_Restore = 9
Public Const SW_Show = 5
Public Const SW_ShowMazimized = 3
Public Const SW_ShowMinimized = 2
Public Const SW_ShowMinnoActive = 7
Public Const SW_Showna = 8
Public Const SW_ShownoActivate = 4
Public Const SW_ShowNormal = 1
Public Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA"
(ByVal hWnd As Long, ByVal IpOperation As String, ByVal IpParameters As
String, ByVal IpDirectory As String, ByVal nShowCmd As Long) As Long
Public Sub ExecuteFile(sFileName As String, sAction As String) 'sAction can
be either "Open" or "Print"
Dim vReturn As Long
If ShellExecute(Access.hWndAccessApp, sAction, sFileName, vbNullString,
SW_ShowNormal) < 33 Then
MsgBox "File not found"
End If
End Sub
Then from a command button on a form the module is called in this subroutine:
Private Sub Option62_Click()
Dim sFileName As String
sFileName = Me.txtMapLoc
Call ExecuteFile(sFileName, "Print")
End Sub
It causes a message to come that says, "Microsoft Access for Windows has
encountered a problem and needs to close. We are sorry for the
inconvenience."
Is there something wrong with my code or is a library reference missing? I
have the Shell Library checked.
Thanks