Find Date from combo box in Flex Grid

Posted on 2009-02-23
Medium Priority
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

therealmongoose earned 2000 total points
ID: 23742903

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

Author Comment

ID: 23745538
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
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.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Suggested Courses

749 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