Solved

Data Report Between Two Dates

Posted on 2000-05-02
6
261 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

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…
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…

776 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