Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

global paramter? 1

Status
Not open for further replies.

xdia

MIS
May 23, 2002
20
0
0
US
Hello,

I have to create report every month comparing datas from last year to this year like May 2001 and May 2002. Currently I change dates eveytime I run the reports. What would be the easiest way to set this up without having to make changes. Also, I have to do this for about 20 or more reports so is there any way to make it so that when I enter the dates once it would be recognized for all the other queries or what not. I am not sure what would be best way to do this.
 
Hi,
I run a series of reports similar to the set you are running. Here is how mine works:

I have a function that prompts for a date once (when mydate is 12:00:00 AM (the default value):

Public Function getdate() As Date
Dim datDate As Date
Select Case mydate
Case #12:00:00 AM#
datDate = InputBox("Enter Date", "Enter Date")
mydate = datDate
End Select
getdate = mydate
End Function

I enter any date in the month I am reporting on(in MM/DD/YY format). The query that is the source for the reports has the following criteria:

Month([ACCI_ANALYSIS_DATE])=Month(GETDATE()) And ((Year([ACCI_ANALYSIS_DATE])=Year(GETDATE())) Or (Year([ACCI_ANALYSIS_DATE])=Year(DateAdd("yyyy",-1,GETDATE()))))

(Be careful about the parentheses--I'd cut and paste)

I get all of the rows of the Accident table for the month I entered, plus all rows for the same month, one year ago. This sounds like the same thing you're trying to do.

mydate is a global variable declared in the General Declarations as:

Global mydate as Date

Good luck. If I am understanding your problem correctly, I think this solution will work for you.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top