Newbie needs varible help

rothjm

Registered User.
Local time
Today, 07:08
Joined
Jun 3, 2003
Messages
46
I am creating a help desk database.
I am creating a report to pull the tech's work he did within a date range.
The user runs the report and I prompt them for the tech's name and a date range with a form.
I have 3 global variables - Gl_Tech (string), Gl_BeginDate (date), Gl_EndDate (date).
I have the functions created and I am calling them in my query.
The Tech function works and the query & report show the tech's work. When I try to add the dates it doesn't pull.
I put a msg box in my function and it returns the expected date but it does not work. It is like the datatype is a string in the function but my field is a date datatype.
Any ideas?

I know I can put the prompt right in the criteria of the query but I would like to pull from the form. I also want to use these dates on the title of the report.

Here is my module code.
Option Compare Database

Global Gl_GetTech As String
Global Gl_BeginDate As Date
Global Gl_EndDate As Date

Public Function GetTech()
GetTech = Gl_GetTech
End Function

Public Function GetBeginDate()
BeginDate = Gl_BeginDate
MsgBox (BeginDate)
End Function

Public Function GetEndDate()
EndDate = Gl_EndDate
MsgBox (EndDate)
End Function

Thanks for any advice!
Jeff
 
You have an error in your functions. This is the correct syntax:

Public Function GetBeginDate()
GetBeginDate = Gl_BeginDate
MsgBox (BeginDate)
End Function

Public Function GetEndDate()
GetEndDate = Gl_EndDate
MsgBox (EndDate)
End Function

Then names of the functions are GetBeginDate and GetEndDate not GetDate adn EndDate....

hth,
Jack
 
Ah, wonder how I missed that.
Thanks Jack.
That got me going!
Great!
 
Ok, now how do I get the global variable on the a report title?
Like if I wanted to put BeginDate to EndDate in a Text Box.
What would the syntax be?
Thanks again.
Jeff
 
In the On Activate event of the Report use code like this:

Me.UnboundControlOnReport = "Between " & GL_BeginDate & "And " & GL_EndDate

hth,
Jack
 
Thanks Jack!
That worked for me!
Thanks again for all your help!
 
Jeff -

You are welcome. Continued success with your project....

Jack
 

Users who are viewing this thread

Back
Top Bottom