Results 1 to 5 of 5
  1. #1
    tdelios is offline Novice
    Windows 8 Access 2013
    Join Date
    May 2015
    Posts
    8

    DoCmd.OpenReport Not Returning Records In My Report

    Hello All..


    I have a table called "INVOICE" that contains a buch of records. I have a report that contains a few text boxes asociated to the fields in the INVOICE table.
    Within the report, I need to print 3 SPECIFIC records.




    I have a form that is NOT associated to the INVOICE table but instead assoicated to another table. The form contains a button on it. The button's OnClick Event uses the DoCmd OpenReport function to call the report and the specific records I want in the report utilzing the 'where condition'.. below is the code of that command specifically:


    DoCmd.OpenReport "INVOICE REPORT", acViewPreview, , Event_Number = 55 And Event_Number 13 And Event_Number = 32


    Regardless if the report is previewed on the screen out outputted directly to the printer (via acViewNormal), the report is empty. I thought that it was due to my many where conditions and attempted to only put 1 event number and still it did not display any records in my report.


    I then assumed that maybe it was a display issue with my computer. so on my report's OnFormat Event, I put some code to test my theory and the debug kicked in basically telling me that the report really doe s not contain any records..


    So the million dollar question.. What is wrong with my DoCmd OpenReport statement that is causing the report not to display any records in it? Do I need to do something to my report to achieve the results I'm looking for?

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Perhaps your "WHERE" clause needs " marks and replace ANDs with ORs. Perhaps something like:

    DoCmd.OpenReport "INVOICE REPORT", acViewPreview, , "Event_Number = 55 OR Event_Number 13 OR Event_Number = 32"

    assuming that Event_Number is a numeric field.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    tdelios is offline Novice
    Windows 8 Access 2013
    Join Date
    May 2015
    Posts
    8
    Quote Originally Posted by Bob Fitz View Post
    Perhaps your "WHERE" clause needs " marks and replace ANDs with ORs. Perhaps something like:

    DoCmd.OpenReport "INVOICE REPORT", acViewPreview, , "Event_Number = 55 OR Event_Number 13 OR Event_Number = 32"

    assuming that Event_Number is a numeric field.

    I just tried that and still same results.. I even tried using a single event number "Event_Number = 55" and still the report comes out blank and the debug for the OnFormat code is telling me no records are detected on the report. UGH!

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Quote Originally Posted by tdelios View Post
    I just tried that and still same results.. I even tried using a single event number "Event_Number = 55" and still the report comes out blank and the debug for the OnFormat code is telling me no records are detected on the report. UGH!
    What code do you have in the On Format event
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    tdelios is offline Novice
    Windows 8 Access 2013
    Join Date
    May 2015
    Posts
    8
    Quote Originally Posted by Bob Fitz View Post
    What code do you have in the On Format event
    sorry for the delayed response.. ISP service went down for a while..

    It seems that by closing down Access and giving my computer a good reboot that it solved the problem.. but the quotes you suggested actually helped out with the problem as well.. so thank you for that!

    cheers
    Tom

Please reply to this thread with any new information or opinions.

Similar Threads

  1. DoCmd.OpenReport Problem
    By lowesthertz in forum Modules
    Replies: 13
    Last Post: 03-17-2015, 01:17 PM
  2. Replies: 2
    Last Post: 07-15-2014, 07:22 PM
  3. DoCmd.OpenReport Where Argument
    By snipe in forum Programming
    Replies: 2
    Last Post: 04-24-2014, 10:24 AM
  4. Need help w/ docmd.openreport
    By jwill in forum Reports
    Replies: 3
    Last Post: 06-04-2012, 09:49 PM
  5. DoCmd OpenReport ... where condition with a Like
    By Grooz13 in forum Programming
    Replies: 4
    Last Post: 08-31-2010, 09:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums