Results 1 to 4 of 4
  1. #1
    Mattbro is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2012
    Posts
    95

    Getting dates from query parameters onto a report


    Hi all,
    Sorry if this sounds complicated;
    I have a table -FinalSheet2, containing data including [Received Date].
    I have A report 'RpAudit' which is populated by a query 'AuditStats'.
    The datasource for 'AuditStats' is from a primary query 'QryAudit'.
    The datasource for the query 'QryAudit' is table -FinalSheet2
    I have a form 'FmAudit' which contains two textboxes-Start and End. The user enters the dates they wish to audit, and using the 'on.update event, the dates are used to generate the report 'RpAudit'. The dates manifest in the query 'QryAudit' by the criteria; 'Between [Forms]![Audit]![Start] And [Forms]![Audit]![End]' on the [Received Date] field.
    Upon update of the the End textbox, the 'FmAudit' Form closes, and the report appears. Lovely.

    What I want is to put two textboxes -TbStart and TbEnd on the RpAudit report that display the dates entered in the Start and End textboxes on the form FmAudit so the reader will know the dates audited. I have tried binding the Control Sources of TbStart and TbEnd to the Start and End textboxes on the 'FmAudit using the Expression Builder, but am just getting '?Name' appearing. Any ideas gratefully appreciated.
    Regards,
    Mattbro

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Typically, what I do in this case is create a single record table that I use to store the values of my Form selection, so all the criteria I enter is bound to a single record table.
    Then, I include that table in my query that the Report is based on. Since it is a single record table, you don't even need to create a relationship between that table and the other tables in the query (the Cartestian product between a single record table and and other tables/queries keeps the same number of records). Then, those criteria fields are available for you to place on your report.

  3. #3
    Mattbro is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2012
    Posts
    95
    Ah-cracked it. The way to do it was to bind the textboxes on the report to the textboxes on the form, but to remove the DoCmd 'close' command and replace it with me.visible=false. Thus the form remains open and the data appears. I liked your idea, JoeM, but had trouble binding the control souce-still got the '?name' caption!

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I liked your idea, JoeM, but had trouble binding the control souce-still got the '?name' caption!
    One sure-fire way to avoid that is to start from scratch, creating a new Form with the table as your Control Source, and then add fields directly from the Field box (drag and drop). Then you are certain to get all the sources set properly.

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

Similar Threads

  1. Replies: 8
    Last Post: 02-06-2013, 11:21 AM
  2. Parameters for Dates
    By mike02 in forum Queries
    Replies: 4
    Last Post: 07-09-2012, 10:49 AM
  3. Replies: 1
    Last Post: 03-07-2012, 09:00 AM
  4. Replies: 0
    Last Post: 07-05-2010, 08:00 AM
  5. Replies: 0
    Last Post: 07-27-2009, 07:51 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