[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

PDF not working in Axccess 2003 after creating a new report

Posted on 2009-03-29
11
Medium Priority
?
330 Views
Last Modified: 2012-05-06
I generated an Access 2003 DB with the help of several experts, and I thank everybody for all there help. I took the advise of the experts and created a report, which I want to make into a PDF. I received some code to put behind my PDF button on my form "contract", and it was working great with my test report "contracts". So far so good. Now I renamed my test report and used the wizard to make a new one, and I kept the name the same as the test report that worked. Now the PDF button prints the report to my laser printer instead of CutePDF, like it used to. I can't see anything I did to cause this, but I am sure I did. I figured keeping the report name the same as the test one that worked would avoid problems, but apparently I was wrong. I uploaded the DB so you can hopefully spot what I did wrong. The other thing I noticed is when I hover my cursor over the old test report it shows the printer as CutePDF, asnd when I hover the cursor over the new report it shows my laser printer.
thanks experts...Bob
Limo-Rental.mdb
Limo-Rental-be.mdb
0
Comment
Question by:bobrossi56
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 11

Expert Comment

by:mildurait
ID: 24015346
Prior to running the report you can set the application printer with vba.  Something like below may work for you.

Sub cmdPrint_Click()
 
       dim p as printer
       for each p in application.printers
             if p.name = "CutePDF" then
                  application.printer = p
                  exit for
             end if
       next

       'your code to open/print report

End Sub
0
 

Author Comment

by:bobrossi56
ID: 24015364
The code I got from one of the other experts specifically created a PDF of just the current form I had open. Will the above do that? I was hoping to continue to use the code I had and figure out why creating a new reoprt with the same name broke it.
0
 
LVL 11

Expert Comment

by:mildurait
ID: 24015373
All the above will do is the set the printer for your application.
Suggest you try running this prior to running the existing code.
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 

Author Comment

by:bobrossi56
ID: 24015381
OK, I did and it erros on "if p.name "
0
 
LVL 11

Expert Comment

by:mildurait
ID: 24015427
Try below & Let me know what comes up in the message box.
Get the default printer
    
    Set prtDefault = Application.Printer
    
    'assign CutePDF, make sure the name is correct in printer & faxes
    strDefault = "CutePDF Writer"
    'SetDefaultPrinter "CutePDF Writer"
    dim p as printer
    for each p in application.printers
        if p.DeviceName = strDefault then
           application.printer = p
           exit for
        end if
    next
    msgbox appliction.printer.DeviceName
   
   'Print the report
    stDocName = "contracts"  '                               Right below is the filter/criteria
    DoCmd.OpenReport stDocName, acNormal, , "PriKey = " & Forms![contract]![PriKey] & ""
         
   ' Reset the default printer
    Application.Printer = prtDefault

Open in new window

0
 
LVL 11

Expert Comment

by:mildurait
ID: 24015436
Sorry let me  try again.
    Set prtDefault = Application.Printer
    
    'assign CutePDF, make sure the name is correct in printer & faxes
    strDefault = "CutePDF Writer"
    'SetDefaultPrinter "CutePDF Writer"
    dim p as printer
    for each p in application.printers
        if p.DeviceName = strDefault then
           application.printer = p
           exit for
        end if
    next
    msgbox application.printer.DeviceName
   
   'Print the report
    stDocName = "contracts"  '                               Right below is the filter/criteria
    DoCmd.OpenReport stDocName, acNormal, , "PriKey = " & Forms![contract]![PriKey] & ""
         
   ' Reset the default printer
    Application.Printer = prtDefault
 

Open in new window

0
 

Author Comment

by:bobrossi56
ID: 24015466
OK, when I click the PDF button I get  a message box that says "CutePDF Writer", and when I click OK, it prints the report to my laser printer.
0
 
LVL 11

Accepted Solution

by:
mildurait earned 2000 total points
ID: 24015521
OK.
The issue is not with the code, it is with page setup.

a) Open up your report in design view.
b) From the file menu choose page setup.
c) On the page tab choose default as the printer for contacts.
0
 

Author Comment

by:bobrossi56
ID: 24015555
Your a genius....that was it. I knew it had to be something about the new report vs. the test report because the code I had worked before. I didn't know, being a novice as I am, that this option was available in a report to pick a specific printer. Thanks so much for sticking with me. Much appreciated.
-Bob
0
 

Author Closing Comment

by:bobrossi56
ID: 31564140
Great help and problem solved...thx agaiin
0
 
LVL 11

Expert Comment

by:mildurait
ID: 24015561
No problems..
Not genius yet (guru)...
You have to answer lots of questions here before you become a genius LOL
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a serious pitfall that can happen when deleting shapes using VBA.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question