Printing documents from Access form

T

Tony Williams

I have an Access database that we use as a document index system. The
documents can be Word, Excel, pdf's etc I have a command button on a form
that opens the document in whatever program is relevant. The code I use
(which incidentally came from this newsgroup and very grateful we were for
it!!!) is
Private Sub Cmdstart_Click()
On Error GoTo Err_Handler

Dim strPath As String
If IsNull(DocURLtxt.Value) Then
strmsg = "You must enter the Document URL to use this function
'" & DocURLtxt.Value _
& "'." & vbCrLf & "Please enter the URL for " _
& "this document now."
If MsgBox(strmsg, vbQuestion) = vbOK Then
Exit Sub
End If
End If
strPath = Nz(Me!DocURLtxt, "")
If Len(strPath) > 0 Then
StartFile strPath, WIN_NORMAL
End If

Exit_Handler:
Exit Sub

Err_Handler:
MsgBox Err.Description, vbExclamation, "Error No: " & Err.Number
Resume Exit_Handler

End Sub

However I would like another button that actually sends the document
straight to print without having to open the document in the application.
For example if we have the path to a Word document I want the command button
to send the document to a printer, or at least open a print dialog box
without opening the document in Word first and then printing from there. Is
this possible?

As ever TIA
Tony Williams
 

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