Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    Anaheim, California, USA
    Posts
    560
    Thanks
    17
    Thanked 2 Times in 2 Posts

    Reports won't print (2007)

    I have a database that was developed in Access 2000 and then upgraded to 2003. Now, I have 2007, while the other users are still using Access 2003.

    I have all my reports listed in a table. On the main menu is a drop down box listing the reports. The user selects the report and then clicks on a command button and the following is executed.

    Private Sub cmdPrintReports_Click()
    On Error GoTo cmdPrintReports_ClickError

    Dim strReportName As String
    Dim strRecordSource As String

    strReportName = Me![cboReports]
    strRecordSource = Me![cboReports].Column(1)

    If Nz(Me![cboReports]) = " " Then
    Resume cmdPrintReports_ClickExit
    End If
    DoCmd.OpenReport strReportName, acViewPreview, strRecordSource

    cmdPrintReports_ClickExit:
    Exit Sub

    cmdPrintReports_ClickError:
    MsgBox "Please select a report" 'Err.Description
    Resume cmdPrintReports_ClickExit
    End Sub

    This works great for the 2003 users but for myself, when I click on the button that this is attached to, I get a message that says "Please Select a Report". I don't know if this is a problem because I am using 2007 or if it is something else.

    This database is set up with security, so that you have to enter a password to open it. I used the built in security and it seems to work fine but now, sometimes when I open it, it wants to run a set up routine, that takes several minutes to complete. I also have a problem when I open some of my other databases, the ones that are connected to this one, where they don't open completely, information is missing from the screen, that type of thing. If I close it and re-open, then it works just fine.

    Finally, I also have a commercial maintenance tracking system called PMC that is based on Access and i am wondering if that is interferring with my databases. I was thinking about removing PMC and see if the problems go away but the tech guys have to re-load it and they are only here once a month. Oh, and they don't support any databases that were written by users, isn't that wonderful customer service!

    I know this is long and multiple problems. If there are any resources out there showing how to run 2007 and 2003 together that I could read, that would be great too. Thanks for the help.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Reports won't print (2007)

    I don't have Access 2007, so I cannot offer specific help, but try commenting out the line

    On Error GoTo cmdPrintReports_ClickError

    temporarily to see where the error occurs.

    Note: the line
    <code>
    If Nz(Me![cboReports]) = " " Then
    </code>
    probably won't do what you want. I'd either use
    <code>
    If Nz(Me![cboReports], "") = "" Then
    </code>
    or
    <code>
    If IsNull(Me![cboReports]) Then</code>

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Reports won't print (2007)

    It would be nice to know what line caused the error. I'm guessing it was the "Docmd.OpenReport" line, and I'm also guessing it is caused by Access2007. Try to open the report manually to see what happens.

    As a note, I'm not recommending anyone upgrade to Access2007 yet.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  4. #4
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    Anaheim, California, USA
    Posts
    560
    Thanks
    17
    Thanked 2 Times in 2 Posts

    Re: Reports won't print (2007)

    Thanks Hans and Mark,

    To answer the last question first, yes, I can open the reports manually. When I remmed out the line that Hans referred to, the error is on the "Docmd.OpenReport" line, just like Mark said.

    I'm usually a willing test subject, that's why I have it. We are probably all going to upgrade in the fall.

    One additional note, I mentioned that I have a commercial Access application running, I found out that it runs on Access 2000, not quite sure how that works, with the different versions running on one machine or if it makes any difference at all. Thanks for the help.

  5. #5
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Reports won't print (2007)

    It might help if you would add the Error Description to your error message. That would help in figuring out what is going wrong.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  6. #6
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    Anaheim, California, USA
    Posts
    560
    Thanks
    17
    Thanked 2 Times in 2 Posts

    Re: Reports won't print (2007)

    I'm sorry Mark, I'm not sure I understand what you are saying. Thanks.

  7. #7
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Reports won't print (2007)

    Your error message merely says "Please select a report!". This is not particularly helpful. If you add the error description to the message, we might get some idea as to what is happening. Something like this:

    MsgBox "Please Select a Report" & vbcrlf & vbcrlf & "Error: " & Error.description
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  8. #8
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    Anaheim, California, USA
    Posts
    560
    Thanks
    17
    Thanked 2 Times in 2 Posts

    Re: Reports won't print (2007)

    Sorry to take so long in responding. I was pulled off for other projects but now we are getting closer to swithching everyone over to Access 2007, probably in September, the reports work fine in Access 2003, and now I need to figure out why this doesn't work.

    I did what you suggested Mark, (btw, not sure if this changed in A2007 but it should be Err.description, not Error.description) and received the following error message:

    ---------------------------
    Microsoft Office Access
    ---------------------------
    Please Select a Report



    Error: The Microsoft Office Access database engine could not find the object 'Emergency Contacts'. Make sure the object exists and that you spell its name and the path name correctly.
    ---------------------------
    OK
    ---------------------------

    What I am doing is this. I have a table where I list my reports, with their Access name, such as rptEmergencyContacts, their human name, Emergency Contacts and then another column where I use numbering to sort the list. On my Main Menu form, there is a combo box that lists the human name, through a query, the report is selected and then the user clicks on the command button and this opens the report in Print Preview. The following are the critical properties of the combo box (I printed out the property sheets for both versions and compared. The only difference that I detected was that in the 2007 version, the ListRows setting was 16 and in the 2003 version, it was 8) and they are the same for both A2003 and A2007.

    RowSource: qryReports
    ColumnCount: 3
    ColumnWidths: 0;2880;0
    BoundColumn: 1

    And then finally, here is the code that is attached to the Print Command Buttton, (I left out the error trapping, since that all seems to work, thanks to Mark's help)

    Dim strReportName As String
    Dim strRecordSource As String

    strReportName = Me![cboReports]
    strRecordSource = Me![cboReports].Column(1)

    If Nz(Me![cboReports], "") = "" Then
    Resume cmdPrintReports_ClickExit
    End If
    DoCmd.OpenReport strReportName, acViewPreview, strRecordSource

    Like I said, this all works fine in A2003, it's only on the one machine, mine, that is running A2007 that there is a problem. I hope I haven't made this too lengthy and it makes sense to you . Thanks in advance for any help you can provide.

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Reports won't print (2007)

    I still don't have Access 2007, so I cannot help you with your problem, but I have two remarks about your code:

    - I would move the If Nz(Me![cboReports], "") = "" Then ... End If section up to before the instruction where you assign a value to strReportName - no point in doing that if no name has been selected.

    - I wouldn't use Resume if no error has occurred, use Exit Sub instead, or GoTo cmdPrintReports_ClickExit

  10. #10
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Reports won't print (2007)

    Can you open the report directly from database window? Does it give an error?
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  11. #11
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    Anaheim, California, USA
    Posts
    560
    Thanks
    17
    Thanked 2 Times in 2 Posts

    Re: Reports won't print (2007)

    Yes, everything works fine from there, no errors or anything. That's how I have been using them in the meantime.

  12. #12
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Reports won't print (2007)

    I think you need to look at that combobox. According to your code, that column(1) should be the report name, but I'm guessing it isn't. I'd step through the code for both A2003 and A2007 and check the values.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  13. #13
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    Anaheim, California, USA
    Posts
    560
    Thanks
    17
    Thanked 2 Times in 2 Posts

    Re: Reports won't print (2007)

    Just for grins, I re-named the combo box and created a new one with the same name as the first one. I got the same results, but it still works in A2003.

    How do I step through the code and check the values? Thanks.

  14. #14
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Reports won't print (2007)

    You can set a breakpoint on a line by clicking in the line and pressing F9 or by double clicking in the gray bar to the left of the line.
    When the code runs, it will pause at the breakpoint, with the line highlighted in yellow.
    You can then
    - Single-step through the code by pressing F8 repeatedly.
    - Resume auotmatic execution by pressing F5.
    - View the value of variable by hovering the mouse pointer over them in the code.
    - Press Ctrl+G to activate the Immediate window, then type ? followed by a space and an expression, then Enter, to see the value of the expression.

  15. #15
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Reports won't print (2007)

    Insert a line of code that contains the word Stop, like this:

    Stop
    strReportName = Me![cboReports]

    This will stop the code and open the de######. Use Ctl-G to open the immediate window. Use F8 key to step through a line at a time. You can check the value for each variable. do this for both A2003 and A2007 to see if you get same values.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •