Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2015
    Posts
    11

    Help in Opening Report.

    I am trying to open a report with the below where clause to show the records from last 6 months. Doing it in VBA with a docmd, but getting an error. Can't figure out how to do it. Please help. I am kind of new to this.



    DoCmd.OpenReport "Master Pre-Op Patient Report", acViewReport, , "[Initial Consult Date] >= DateAdd(" & "m" & ",-6,Date())"

    Thanks

  2. #2
    Join Date
    Jul 2015
    Posts
    11
    I've tried just using:
    DoCmd.OpenReport "Master Pre-Op Patient Report", acViewReport, , "[Initial Consult Date] >= DateAdd(m,-1,Date())"

    but both methods pop up a box asking me to input something for m. If I just enter m in the pop up box it works. But I don't want the pop up box to show up.

  3. #3
    IrogSinta is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jun 2015
    Posts
    103
    Try this:
    DoCmd.OpenReport "Master Pre-Op Patient Report", acViewReport, , "[Initial Consult Date] >=#" & DateAdd("m",-1,Date()) & "#"

    Ron

  4. #4
    Join Date
    Jul 2015
    Posts
    11
    That worked great. Thanks!

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

Similar Threads

  1. Replies: 1
    Last Post: 05-27-2013, 08:54 AM
  2. Replies: 1
    Last Post: 01-10-2012, 03:44 AM
  3. Report not opening, just printing.
    By Desstro in forum Reports
    Replies: 3
    Last Post: 12-11-2010, 01:36 PM
  4. Report not opening to view
    By Desstro in forum Programming
    Replies: 4
    Last Post: 11-25-2010, 05:36 PM
  5. Opening a report
    By mwabbe in forum Access
    Replies: 3
    Last Post: 09-17-2010, 09:19 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