[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Date range on a report

Posted on 2006-11-03
3
Medium Priority
?
140 Views
Last Modified: 2010-04-30
How do I put a date range on a report from textfields on the form that calls the report. I do not use the DE. Right now all I can get is todays date from the functions that come with the controls.

So if I have txtfields(48) and txtfields(49) where the user inputs the dates on form8 how do I get the datareport4 to show the dates in the report...preferably the header.
0
Comment
Question by:mindserve
  • 2
3 Comments
 
LVL 20

Accepted Solution

by:
clarkscott earned 500 total points
ID: 17873065
create 2 global variables:

public glbBeginDate as date
public glbEndDate as date

Now... create to functions to retrieve these values


Function get_glbBeginDate() as date
get_glbBeginDate = glbBeginDate
end function


Function get_glbEndDate() as date
get_glbEndDate = glbEndDate
end function


Next, in the form8 - (probably in the command button that fires the report) assign values to the public date variables

glbEndDate = 0
glbBeginDate = 0

If trim(me.txtfields(48).text) <> "" then
    glbBeginDate = me.txtfields(48)
end if
if trim(me.txtfields(49).text) <> "" then
   glbEndDate = me.txtfields(49)
end if


Create 2 fields in the header of your report.
Control source = get_glbBeginDate()
Control source = get_glbEndDate()


Your dates will appear in your report.   Also note, these 'get' functions can be used in queries and other places where you need to access these date values - very valuable!!!

Scott C


0
 
LVL 20

Expert Comment

by:clarkscott
ID: 17874548
Good luck!
Keep in mind... this method allows you to use variables in query criteria.
Simply follow the above procedure and use the 'get' function in the query.

Where ([yourField] =get_glbXVariable())

Scott C




0
 
LVL 1

Author Comment

by:mindserve
ID: 17874672
Thanks Scott,
it really helped me out quite a bit...:)
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month18 days, 4 hours left to enroll

829 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