I am newbie in the world of programming..
and I am using vb6..
can anyone help me to do get the data ranging it by the date.
What Im trying to mean is ex:
I have a data which includes data form january to june.
I want to display feb to march only..
data ranging from feb 1,feb2,feb3,feb4.....march31.

-any help is highly appreciated..

8 Years
Discussion Span
Last Post by debasisdas

Access, SQL, MSDE, dBase, Fox Pro, Alpha5? What is your DBMS?

a simple generic way of pulling information based upon dates is as follows.

Select * from yourtable where yourdatefield >= somedate AND yourdatefield <= somedate

Then there is the between statement if your DBMS supports it

From VB press F1>GoTo index tab and type in Between...And operator>Click on example
code from example for access and the example northwind dababase

Sub SubQueryX()

   Dim dbs As Database, rst As Recordset

   ' Modify this line to include the path to Northwind
   ' on your computer.
   Set dbs = OpenDatabase("Northwind.mdb")
   ' List the name and contact of every customer 
   ' who placed an order in the second quarter of
   ' 1995.
   Set rst = dbs.OpenRecordset("SELECT ContactName," _
      & " CompanyName, ContactTitle, Phone" _
      & " FROM Customers" _
      & " WHERE CustomerID" _
      & " IN (SELECT CustomerID FROM Orders" _
      & " WHERE OrderDate Between #04/1/95#" _
      & " And #07/1/95#);")
   ' Populate the Recordset.
   ' Call EnumFields to print the contents of the 
   ' Recordset. Pass the Recordset object and desired
   ' field width.
   EnumFields rst, 25


End Sub

Good Luck

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.