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

Recommended Answers

All 2 Replies

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.
   rst.MoveLast
   
   ' Call EnumFields to print the contents of the 
   ' Recordset. Pass the Recordset object and desired
   ' field width.
   EnumFields rst, 25

   dbs.Close

End Sub

Good Luck

so what are you passing , month name ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.