Getting a Date Range onto the Header of a Report (1 Viewer)

johncroc

New member
Local time
Today, 12:35
Joined
Feb 25, 2013
Messages
4
I have a challenge to which I've been unable to find a satisfactory solution. My fear is that one of you-all who are more used to the Access way of doing things will have the simplest of answers and I will will look foolish for having asked. But it's time to put my ego away and get some help!

I've created a report, based on a table that gets created as part of a complicated process of data gathering and massaging. At the very beginning of the process, the user is prompted for a date range (BegDate, EndDate). These are collected using InputBox() functions in my code. Those dates are then used throughout the processing of the data. The question is, how do I get them onto the page header of the report?

Thank you so much for your gentle attention.

John
 

Beetle

Duly Registered Boozer
Local time
Today, 12:35
Joined
Apr 30, 2011
Messages
1,808
You could;

  • Create a small table with just StartDate and EndDate fields and pop up a form bound to this table for the users to enter the values at the appropriate time in the process. The advantage here is that the values are stored for later use if needed or if your code falls over for some reason you can restart the process without the user having to re-enter the values.
  • If you don't want to use a table, you could still use a form with unbound text boxes then just hide it after the values are entered. As long as the form is open the values will be available.
  • Assign the input box values to global public variables.
 

johncroc

New member
Local time
Today, 12:35
Joined
Feb 25, 2013
Messages
4
Thanks Beetle! I had considered the "store them in a table" idea but was unclear as to how to get them onto the report later; since the report is already based on a different table. Can I bind text-boxes/fields in the page header to a table that is different than that which produces the detail?
Getting the dates from the user is already done and they are assigned to variables in a Sub called Main(). Then they are passed to Subs/Functions that need them. I really was wondering if I could just access the report object (and the text boxes on it) in some way, such as myReport.PageHeader.BegDate.Text = "November 6, 2012." If I could do that then I could just inject the date strings before actually running the report. Any thoughts?

John
 

Beetle

Duly Registered Boozer
Local time
Today, 12:35
Joined
Apr 30, 2011
Messages
1,808
Can I bind text-boxes/fields in the page header to a table that is different than that which produces the detail?

No, but you can use unbound text boxes and use DLookup to return values from another table (if you're going to go with the table option for storing your dates). Or you could use the Open event of the report to assign values to those unbound text boxes at runtime based on your variables.
 

Users who are viewing this thread

Top Bottom