print from combo box

J

Joanne

I have a combo box based on a listing of documents from a table
I would like the user to be able to click on his choice of document
and have it go to the printer.
When I click on a filename, I get the debug screen and the command
DOCMD.Printout is highlighted and of course, the doc does not go to
the printer.
Maybe I am taking the wrong approach to this problem and the combo box
is not meant for this type of work?
Could someone please advise if this is the improper approach and
suggest what type of control/solution I should be trying to create?
TIA
Joanne
 
B

Brendan Reynolds

The Access PrintOut command prints the currently active *Access* object. To
print the documents, you'll need to automate the appropriate application.
For example, if the documents are Word documents, after adding a reference
(in the VBA window, go to Tools, then References) to the Microsoft Word
object library, you can print the documents with code something like this
....

Private Sub Combo0_AfterUpdate()

Dim strPath As String
Dim objWordApp As Word.Application

strPath = CurrentProject.Path & "\" & Me!Combo0
Set objWordApp = New Word.Application
objWordApp.Documents.Open strPath
objWordApp.PrintOut

End Sub

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
J

Joanne

Thank you for the heads-up Brendan
I appreciate your time and will get right on this and see if I can
make it work, newbie that I am :cool:
 

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