• Common Dialog box (Access 2000)

    Author
    Topic
    #371793

    I have a need to open a common dialog box (the printer dialog) via code from Access, retrieve the details and then use those details for my own purposes.
    I could create a form with the required fields, but filling the printer list is a bit messy. In plain VB the common dialog boxes are easy to pop up. How do I do it from within Access?
    Thanks for your help.
    Peter

    Viewing 0 reply threads
    Author
    Replies
    • #592125

      Welcome to the differences between Access and VB. One is that the common dialogs are NOT as easy to work with. The usual way to get printer information from Access is to use PrtDevNames, but that relates to the devices available for printing reports, etc. from Access. You can always use the WinAPI to give you a handle into the PrintDev library. What are you trying to popup the print dialog for?

      • #592315

        I suspected that it was going to be difficult. Why oh why does MS do this to us? A bit of consistency would eb nice (but I guess things have come a long way!).
        I just wanted an easy way to get the users to choose which printer and how many copies. I’ll have to create my own form for it.
        Thanks again for your help.
        Peter

        • #592317

          I’m still puzzled – doesn’t the standard Access print dialog box you get with File/Print give you the choice of any printer defined on the workstation?

          • #592347

            Well, yes it does. But I don’t want to print any Access object, I want to print some Adobe Acrobat PDFs from within Access. (It’s along story, but basically I’m using an Access database as a repository and index to a pile of documents.) So I need to print those docs out from within Access. I’ve found the right cmd line switches to get it to work, from the VBA forum on Woodys. I’ll allow the user to choose the printer and number of copies, then Access will be shelling to Acrobat to print the documents.

            • #592376

              Can’t you print from the Acrobat OCX?

            • #592540

              Good question. I’m not sure if you can. I couldn’t find any doc on Adobe’s website about it, except for the information below (Support Knowledgebase Document 320325)
              ————————————————————————-
              ActiveX Control in Acrobat 4.0 and Later Is Not Full-Featured Control

              Adobe Acrobat 4.0 and later includes an ActiveX control for Windows. This control enables Microsoft Internet Explorer to display Adobe PDF files in the browser window using an Acrobat viewer, such as Acrobat or Acrobat Reader. This ActiveX control is for use only with Internet Explorer; it is not a full-featured, robust ActiveX control that enables other applications to display PDF files.
              ————————————————————————-

              Maybe there is some undoc’d features there?
              In the future, I can see I’ll need to use Access to drive printing of other doc types as well, that may not have a control. So cmd line options seemed more appropriate.
              I was hoping for a command on a printer object that could just take a filename, figure out what the association was from that files extension (from the registry – e.g. PDF uses Acrobat) and send it to the printer. Certainly Windows can do that – just drag and drop an object onto a printer shortcut. But I want to do it via VBA. Something like this would have been nice:

              Dim myPrinter As Printer
              myPrinter.Name = "W2Plain Paper"
              myPrinter.PrintObjectName = "stuff.pdf"
              myPrinter.Print
              

              Anyone from MS reading this?

            • #592582

              Take a look at this thread in VB/VBA/.Net where something similar was being attempted by VB.

              MS people reading it won’t help, because they don’t own Acrobat … yet! evilgrin The ocx is installed if you install Acrobat reader on a machine too.

    Viewing 0 reply threads
    Reply To: Common Dialog box (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: