Solved

Date range on a report

Posted on 2006-11-03
3
135 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 125 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
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…
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…

728 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