?
Solved

Finding a date range with a SQL statement.

Posted on 2003-02-20
2
Medium Priority
?
185 Views
Last Modified: 2010-04-07
Hello everyone!!!

Im a VB newbie and need some help.  Im connecting to an Access DB using ADODC, I need to be able to show a date range defined by the user using two text boxes.  Maybe even better a way to show the current date and the previous seven days to that.  If any of this is at all possible any answer woud be greatly appreciated, thanks!!!
0
Comment
Question by:lopez22
[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 Comments
 
LVL 14

Accepted Solution

by:
jjardine earned 200 total points
ID: 7988303
You can use the Date Function to get todays date   and I believe if you wanted to get the date 7 days ago you could do something like

oldDate = DateAdd("d",-7,Date)    'this should return it.

You would then pass your two dates in your SQL Statement with   a where clause of WHERE 'Date field' Between '#oldDate#' AND '#Date#'

Hope that helps give some idea.  Good Luck
0
 
LVL 9

Expert Comment

by:apirnia
ID: 7989589
MyDateA = Date()      'This is Today
MydateB = Date() - 1  'This is yesterday
MydateC = Date() - 2  'This is the day befor yesterday
.
.
.
.

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…
Suggested Courses
Course of the Month8 days, 17 hours left to enroll

764 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