Find Date from combo box in Flex Grid

Posted on 2009-02-23
Last Modified: 2012-06-27
Hi Experts,

 I want to know if a date range is selected from 2 combo boxes, How Can I get the relevant info of that range from my flex grid?

For example, user selects 01/01/2009 - 01/02-2009 In combobox.

My flexgrid displays all the data for 2009.

So I want it to find value 1 and value 2 related to those dates, as well as highlight those rows.

Currently using ADODB connection

Thanks in advance...
''' This is my current code, but it doesn't work '''

ElseIf cbo_date_from.Text <> "ALL" And cbo_date_to.Text <> "ALL" Then

    Dim cmd_RSQ As New ADODB.Connection

    Dim rs_RSQ As New ADODB.Recordset


    With cmd_RSQ

    .ActiveConnection = m_Conn

    .CommandText = "SELECT tbl_Operation.Date, Avg(tbl_Operation.Value) AS Original, Avg(tbl_keelingPlot.Value2) AS Isotope" & _

    "FROM tbl_keelingPlot INNER JOIN tbl_Operation ON tbl_keelingPlot.Row = tbl_Operation.Row" & _

    "WHERE tbl_operation.Date Between #" & cbo_date_from.Text & "# And #" & cbo_date_to.Text & "#" & _

    "GROUP BY tbl_Operation.Date" & _

    "ORDER BY tbl_Operation.Date;"

    .CommandType = adCmdText

    End With


    With rs_RSQ

    .CursorType = adOpenStatic

    .CursorLocation = adUseClient

    .LockType = adLockOptimistic

    .Open cmd_RSQ

    End With


    high = rs_RSQ.RecordCount

    For j = 1 To high

           objSheet.Cells(j, 1).value = rs_RSQ!Original 'grd_result.TextMatrix(j, 2)

           objSheet.Cells(j, 2).value = rs_RSQ!Isotope 'grd_result.TextMatrix(j, 3)

    Next j

Open in new window

Question by:Student_101
    LVL 10

    Accepted Solution


    WHERE tbl_operation.Date Between " & clng(cbo_date_from.Text) & " And " & clng(cbo_date_to.Text) & ".....etc

    Author Comment

    Hi therealmongoose,

    I was able to find the selected records from the combo box

    my error was in the spaces in my SQL query, as well as my Where statement shouldve been after the FROm Statement.

    I am almost done with this question now, all I need is to highlight those rows in my flexgrid.

    The first column in the flex grid is the date column, so I think I need to find these dates from the recordset and match it to the text matrix property.

    Hope you can help :)

    Thanks !

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    Article by: Martin
    Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
    What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
    With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now