Solved

Data Report Between Two Dates

Posted on 2000-05-02
6
263 Views
Last Modified: 2008-02-20
I have created a datareport based on the dataenvironment for a table that keeps tract of contacts. I want to be able to print the report between two dates that the user selects, for instance, 021000 and 031500. My preference would be to input the dates from the dropdown calendar control that ships with VB but it seems to always want to give me the time as well as the date as a result of my selection. If this can't be used I guess I could use a pair of input boxes.

Once this is solved, how would I pass these dates to the datareport?

Any help would be most appreciated.

Rev. Michael L. Burns
0
Comment
Question by:wwvagnu
6 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 2772152
As far as using the dates, you can format the Now variable which gives the date and time. For example:

Dim date As String
date = Format(Now,"MMDDYY")

that should return the value you are looking for, obviously you can play with the format to make however you wish.
0
 
LVL 15

Expert Comment

by:StingRaY
ID: 2772160
Date in format YYYYMMDD is better.
Store it as String data type.
It is easy to manipulate.
But if you store in format "MMDDYY"
You can convert it to YYMMDD using Left, Mid, Right Function. Use them in your SQL Statement is okay (For Access Database)

0
 
LVL 2

Expert Comment

by:Tchalkov
ID: 2772365
You'll need to open dynamicly dataenvironment recordsets:



        DataEnvironment.rsCommand1.Source = "select from Table1 where Date1>=#" & strFirstDate & "# and Date1<=#" & strLastDate & "#"
DataEnvironment.rsCommand1.Open
DataReport1.Show


0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Accepted Solution

by:
cys050200 earned 50 total points
ID: 2772517
i feel that the solution would be:
date = Format(Now,"MMDDYY")

0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2773961
cys,
please retract your answer to a comment
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2774893
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…
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…

856 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