Sam Summers
Registered User.
- Local time
- Today, 07:17
- Joined
- Sep 17, 2001
- Messages
- 939
Hi guys,
All i am trying to do here is let the user know if there are any certs being printed or if there are none.
It all prints fine if there are certs, but if there are none, i still get the message "Printing Certs shortly" ??????
Thanks in advance.
*****************************************************
Public Function PrintFile(sFileName As String)
On Error GoTo Err_PrintFile
Dim I As String
Dim S As String
I = Me.First_Name.Value
S = Me.Surname.Value
sFileName = "F:\Personnel Certs\Rope Access\" & I & S & "\" & I & S & ".pdf"
PrintFile = ShellExecute(Application.hWndAccessApp, "Print", sFileName, "", "C:\", 0)
Exit_PrintFile:
Exit Function
Err_PrintFile:
MsgBox "Sorry no files currently stored for this employee", vbInformation + vbOKOnly, "IPDMS Personnel Database"
Resume Exit_PrintFile
End Function
Public Function FileExists(strPath As String, Optional lngType As Long) As Boolean
On Error Resume Next
FileExists = Len(Dir(strPath, lngType)) > 0
End Function
******************************************************
Private Sub PrintCerts_Click()
Dim sFileName As String
If FileExists(sFileName) = False Then
MsgBox "Sorry no files currently stored for this employee", vbInformation + vbOKOnly, "IPDMS Personnel Database"
Else
Me.PrintFile (sFileName)
MsgBox "Printing Certs shortly", vbInformation + vbOKOnly, "IPDMS Personnel Database"
End If
End Sub
All i am trying to do here is let the user know if there are any certs being printed or if there are none.
It all prints fine if there are certs, but if there are none, i still get the message "Printing Certs shortly" ??????
Thanks in advance.

*****************************************************
Public Function PrintFile(sFileName As String)
On Error GoTo Err_PrintFile
Dim I As String
Dim S As String
I = Me.First_Name.Value
S = Me.Surname.Value
sFileName = "F:\Personnel Certs\Rope Access\" & I & S & "\" & I & S & ".pdf"
PrintFile = ShellExecute(Application.hWndAccessApp, "Print", sFileName, "", "C:\", 0)
Exit_PrintFile:
Exit Function
Err_PrintFile:
MsgBox "Sorry no files currently stored for this employee", vbInformation + vbOKOnly, "IPDMS Personnel Database"
Resume Exit_PrintFile
End Function
Public Function FileExists(strPath As String, Optional lngType As Long) As Boolean
On Error Resume Next
FileExists = Len(Dir(strPath, lngType)) > 0
End Function
******************************************************
Private Sub PrintCerts_Click()
Dim sFileName As String
If FileExists(sFileName) = False Then
MsgBox "Sorry no files currently stored for this employee", vbInformation + vbOKOnly, "IPDMS Personnel Database"
Else
Me.PrintFile (sFileName)
MsgBox "Printing Certs shortly", vbInformation + vbOKOnly, "IPDMS Personnel Database"
End If
End Sub