?
Solved

Date range on a report

Posted on 2006-11-03
3
Medium Priority
?
137 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
[X]
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
  • 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month14 days, 16 hours left to enroll

771 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