Retrieve a record from a table based on a combobox value which is of type date

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rakeshop86
    New Member
    • Nov 2009
    • 2

    Retrieve a record from a table based on a combobox value which is of type date

    I have a query like this...
    Code:
    rs.Open "select * from Tab_OrderStat_samp where wrkSlab=" & CmbOrdDt & "", cn, adOpenStatic, adLockOptimistic
    but when a date is selected in the combo box which is there in the table the recordset is not filled by the particular record. In fact it shows recordcount as 0...but when we use count(*) it shows 1 record.

    Please help me out so as to how to retrieve the record details...

    thanks in advance
    Rakesh
    Last edited by NeoPa; Nov 15 '09, 03:40 PM. Reason: Please use the [CODE] tags provided.
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    Dates need to be surrounded by '#' in the SQL string.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32661

      #3
      Please read the thread here
      FAQ - How to Ask a Question
      Your question uses language that makes it more difficult for our Experts to help you and wastes their time.

      I see you are a new poster, but please check out our rules before posting again. I would prefer to avoid anything disciplinary so early on in your membership.

      Administrator.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32661

        #4
        The hash (#) is very important, but not the only important issue when dealing with date literals. See Literal DateTimes and Their Delimiters (#).

        Comment

        • rakeshop86
          New Member
          • Nov 2009
          • 2

          #5
          thank you that answers my question...

          Comment

          Working...