Solved

Date range on a report

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem to skip loop 6 57
Windows 10 start screen issues 9 55
Convert VB6 MSXML2.ServerXMLHTTP process to C# 2 47
VBA: Select SQL query based on a config Sheet v2 11 44
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

803 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