Solved

Date range on a report

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now