Filter Date in The DataGrid using DTPicker1 and DTPicker2

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Serenityquinn15
    New Member
    • Oct 2007
    • 30

    Filter Date in The DataGrid using DTPicker1 and DTPicker2

    Hi!
    I have a question regarding in filtering. I want to Filter my Datagrid1 according to Name of the person and the Date ( which actually, Date from to Date of...).. I don't know How I can do this....

    Example:

    Name: Perla Cruz
    Date From : January 01, 2007
    Date To: January 15, 2007
    This is the basis to filter my datagrid.

    PLease advise me..

    thanks!!!
  • jimmylee
    New Member
    • Feb 2008
    • 17

    #2
    Originally posted by Serenityquinn15
    Hi!
    I have a question regarding in filtering. I want to Filter my Datagrid1 according to Name of the person and the Date ( which actually, Date from to Date of...).. I don't know How I can do this....

    Example:

    Name: Perla Cruz
    Date From : January 01, 2007
    Date To: January 15, 2007
    This is the basis to filter my datagrid.

    PLease advise me..

    thanks!!!

    1.query statement
    select * from table1 between startdate = 'dtppicket1.val ue' and enddate ='dtppicket2.va lue'

    connect recordset to your datagrid
    and then refresh.

    Comment

    • Serenityquinn15
      New Member
      • Oct 2007
      • 30

      #3
      Originally posted by jimmylee
      1.query statement
      select * from table1 between startdate = 'dtppicket1.val ue' and enddate ='dtppicket2.va lue'

      connect recordset to your datagrid
      and then refresh.
      I'm sorry, but on what event do i need to put this code????

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        try to use

        select * from table_name where name="name to select" and date between dtpicker1.value and dtpicker2.value .


        use the above query to open the recordset.

        You might need to format the date of the picker control.

        can execute on click event of any button.

        Comment

        • Serenityquinn15
          New Member
          • Oct 2007
          • 30

          #5
          Originally posted by debasisdas
          try to use

          select * from table_name where name="name to select" and date between dtpicker1.value and dtpicker2.value .


          use the above query to open the recordset.

          You might need to format the date of the picker control.

          can execute on click event of any button.
          I test the code that you gave me but there's no data appear.... Please see my code if it is correct...

          Private Sub Command1_Click( )
          Adodc1.RecordSo urce = "Select * From [Timereport] WHERE Name = '" & CmbEmployee.Tex t & " ' and Timelogging.Dat e Between #" & DTPicker1.Value & "# AND #" & DTPicker2.Value & "# Order by Timelogging.Dat e "
          Adodc1.Refresh
          End Sub

          Thanks

          Comment

          • debasisdas
            Recognized Expert Expert
            • Dec 2006
            • 8119

            #6
            Have selected date from both the dtpickers and selected the name from combo ?

            Is that throwing any error ?

            Comment

            • Serenityquinn15
              New Member
              • Oct 2007
              • 30

              #7
              Originally posted by debasisdas
              Have selected date from both the dtpickers and selected the name from combo ?

              Is that throwing any error ?

              Yes, I selected those combo box but still its empty...
              No errors occur.. but theres no data appeared in data grid...(which actually I have a data to display on that specific date in the datagrid.)

              Comment

              Working...