Solved

Dates change on Report

Posted on 2014-01-14
3
251 Views
Last Modified: 2014-01-15
I have a database and table where the dates will change and need the report to reflect the different dates when the report is ran.  If I create a report with Titles once it seems would need to rebuild the report each time for the new dates.   Is there a way not to have to do this.  I am thinking to build a table of the dates and add text fileds to the report to refer to dates but I am also using a crosstab query with the date ranges and would need to line the columns up to the text fields.

May look like this one month with dates as headings

11/30/13                      12/31/13                   1/31/14
1111                                   5555                           abc
nbc
458



and this the next month


2/28/14                        3/40/14                        4/30/14



My question is whether I can build one report or if a new report will need to be designed each time.
Database7.zip
0
Comment
Question by:leezac
  • 2
3 Comments
 
LVL 24

Accepted Solution

by:
chaau earned 500 total points
ID: 39780712
It is very easy to do. First of all, rename the Labels Name property for the Column Headings to Label1, Label2, Label3. Rename the TextBoxes Name property for the columns to Col1, Col2, Col3.
Then, create the event procedure for report's On Open event. Put this code into the procedure:
Private Sub Report_Open(Cancel As Integer)
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Set db = CurrentDb
    Set rs = db.OpenRecordset("tb_temp_Crosstab")
    
    Me.Label1.Caption = rs.Fields(2).Name
    Me.Label2.Caption = rs.Fields(3).Name
    Me.Label3.Caption = rs.Fields(4).Name
    
    Me.Col1.ControlSource = rs.Fields(2).Name
    Me.Col2.ControlSource = rs.Fields(3).Name
    Me.Col3.ControlSource = rs.Fields(4).Name
    rs.Close
End Sub

Open in new window

I have attached the database where I have modified some dates
Database7.mdb
0
 

Author Closing Comment

by:leezac
ID: 39780764
Thanks - that worked great.
0
 

Author Comment

by:leezac
ID: 39782535
Thanks - I am working on testing all the answers.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now