Results 1 to 4 of 4
  1. #1
    louise is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    112

    Show date parameter in report title even if no records are listed.

    Hello,
    I have a report which lists new members since a given date. It is generated by a query that has the parameter: >= [Enter Date as m/d/yyyy].

    Because I wanted the date to appear in the report title in a different format (and couldn't get it to reformat in the report), I have another field created in the query:


    HeaderDate: Format([Enter Date as m/d/yyyy],"Long Date") which I refer to as a text box in the report title.

    In addition to listing the new members, the report counts them and shows the total in a text box: =Count([MembInfo]![MembInfoID])

    That all works ok unless there are no new members since that date. In that case, the header date is empty (presumably because there are no records in the list) and it looks like an error or failed report, rather than useful information.

    Is there a way to show the Header Date even if there are no new members?

    Thanks!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I NEVER use dynamic parameters in queries. Popup inputs are especially bad because cannot validate user input.

    Instead, have user input parameter to an UNBOUND textbox/combobox/listbox on form. The control can be referenced as dynamic parameter in query but I prefer to pass the criteria to report with OpenReport method.

    DoCmd.OpenReport "report name", , , "[date field]=#" & Me.controlname & "#"

    The textbox on report can refer to the control on form.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    I personally, have users enter the date in a form. They pick their report, and date from a date text box. THIS drives the query criteria, not an on the fly param.
    select * from tbl where [date]=forms!frmRpts!txtDate

    but for your header date you can put an unbound text box and use the same date box in the form...forms!frmRpts!txtDate

  4. #4
    louise is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    112
    Thank you both! Very helpful.

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

Similar Threads

  1. Replies: 3
    Last Post: 08-04-2014, 09:52 PM
  2. Replies: 5
    Last Post: 02-27-2014, 08:25 PM
  3. InStr Parameter in Report Title
    By Huddle in forum Reports
    Replies: 4
    Last Post: 12-04-2012, 02:31 PM
  4. Replies: 1
    Last Post: 01-22-2012, 02:41 PM
  5. Replies: 1
    Last Post: 11-21-2011, 03:22 PM

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