Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Dates change on Report

Posted on 2014-01-14
3
254 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

828 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