just compare dates using datetime.datediff function

and now i hope that you can handle the issue

for example
if you wanna see data (weekly) then just do following

updated_date=old_date-7

And it will result in last week from specified date (old_date) , and similar method will be applicable for months , year and so on . . .

now one more thing may be helpful for you and that is proper use of format function , if you wanna use date as dd/mm/yyyy then use the following

Format(Date, "dd/mm/yyyy")

the above method will produce date in dd/mm/yyyy format

now lets come to the topic And for this you need a sql query that is capable to fulfill your requirements now have following:-

"select * from tbl where field_name between 'start_date' and 'end_date'"

the above sql statment will result all those records which having a date star from 'start_date' upto 'end_date'

replace tbl,field_name,start_date,end_date(which are for example purpose only) with your requirements

hope this helps for you . . .

Edited 3 Years Ago by rishif2

Hello Sir In y db the format of the date is like this mm/dd/yyyy then i have many reports..
example..
Report-------date
Report1------1/23/2013
Report1------1/24/2013
Report1------1/25/2013
Report1------1/26/2013
Report1------1/27/2013
Report1------1/28/2013
Report1------2/01/2013

then i want to show my report in weekly then daily what should i do.. In my Mind I want to use like this.

rs.Open "Select * from ProductInfo where purchase_date ='" & datepicker.value & "'", acd, adOpenForwardOnly

first you have to determine that from which date a week should be considered

and then add 7 to that date

and now implement select query what i showed in my previous post

and still having problems then specify your problem in more clear way

and at last i assume that you know how to create a simple data report

happy coding

Sir In your Previuos Post I don't Understand why u are using

updated_date=old_date-7

can u explain me why?

i used updated_date=old_date-7 , because it takes 7 days back (i.e a week back)
and further at query part you can use it

"select * from tbl where field_name between 'updated_date' and 'old_date'"

hope this helps you to sove the issue . . .

thanks sir ill try my best to solve this issue ^_^

Sir I use this Code for daily record then vb 6 says. Type mismacth Help me Sir

 Dim listx As ListItem
Dim rs As New ADODB.Recordset

If DTPicker1.Value = "" Then
    MsgBox "The Date Field is Empty.", vbExclamation, "Details"
      Else
    rs.Open "Select * from Dailyrecord where purchase_date = '" & DTPicker1.Value & "'", acd, adOpenForwardOnly
If rs.RecordCount = 0 Then
        MsgBox "The Date you Select Does Not Exist!", vbExclamation, "Details"
        txtno1.Text = ""
        txtno1.SetFocus
Else
ListView1.ListItems.clear
While rs.EOF <> True
Set listx = ListView1.ListItems.Add(, , rs.Fields("Receipt"))

listx.SubItems(1) = rs.Fields("BarCode")
listx.SubItems(2) = rs.Fields("ProductName")
listx.SubItems(3) = rs.Fields("Quantity")
listx.SubItems(4) = rs.Fields("Price")
listx.SubItems(5) = rs.Fields("TotalPrice")
listx.SubItems(6) = rs.Fields("purchase_date")
rs.MoveNext

Wend
End If
ListView1.Enabled = True
End If

Edited 3 Years Ago by jovstudios: Add

As per your new thread, your select statement was incorrect. Please correct to the sample I gave you there. If this is answered, please mark as solved, thanx.

Thanks Sir. Im USe LIKE to Identify the date, month and a Year in My db. And My Problem solved.. Thanks for Helping and the Wonderful Idea..

This question has already been answered. Start a new discussion instead.